From ab7530059cc282ca4bb4481b8dc007ef1d559d3e Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 21 Jan 2026 00:56:00 +0000 Subject: [PATCH 1/3] Configurations: 'specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: stable, and CommitSHA: 'eb320d1d85f5b46c3cfe6cf60a1f0de4ef3b01d9' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5777145 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-containerregistry/CHANGELOG.md | 81 + .../_metadata.json | 12 +- .../apiview-properties.json | 627 +- .../azure/mgmt/containerregistry/__init__.py | 6 +- ...gistry_management_client.py => _client.py} | 58 +- .../mgmt/containerregistry/_configuration.py | 18 +- .../azure/mgmt/containerregistry/_patch.py | 4 +- .../mgmt/containerregistry/_utils/__init__.py | 2 +- .../containerregistry/_utils/model_base.py | 1327 ++ .../containerregistry/_utils/serialization.py | 19 +- .../azure/mgmt/containerregistry/_version.py | 11 +- .../mgmt/containerregistry/aio/__init__.py | 6 +- ...gistry_management_client.py => _client.py} | 58 +- .../containerregistry/aio/_configuration.py | 18 +- .../mgmt/containerregistry/aio/_patch.py | 4 +- .../aio/operations/__init__.py | 30 +- .../aio/operations/_agent_pools_operations.py | 828 -- .../aio/operations/_cache_rules_operations.py | 764 -- .../_connected_registries_operations.py | 906 -- .../operations/_credential_sets_operations.py | 772 -- .../aio/operations/_operations.py | 8748 ++++++++++++- .../aio/operations/_patch.py | 4 +- ...private_endpoint_connections_operations.py | 557 - .../aio/operations/_registries_operations.py | 1909 --- .../operations/_replications_operations.py | 767 -- .../aio/operations/_runs_operations.py | 483 - .../aio/operations/_scope_maps_operations.py | 764 -- .../aio/operations/_task_runs_operations.py | 766 -- .../aio/operations/_tasks_operations.py | 612 - .../aio/operations/_tokens_operations.py | 755 -- .../aio/operations/_webhooks_operations.py | 974 -- .../mgmt/containerregistry/models/__init__.py | 216 +- ...y_management_client_enums.py => _enums.py} | 163 +- .../mgmt/containerregistry/models/_models.py | 4712 +++++++ .../containerregistry/models/_models_py3.py | 7811 ------------ .../mgmt/containerregistry/models/_patch.py | 4 +- .../containerregistry/operations/__init__.py | 30 +- .../operations/_agent_pools_operations.py | 1046 -- .../operations/_cache_rules_operations.py | 945 -- .../_connected_registries_operations.py | 1150 -- .../operations/_credential_sets_operations.py | 956 -- .../operations/_operations.py | 10329 +++++++++++++++- .../containerregistry/operations/_patch.py | 4 +- ...private_endpoint_connections_operations.py | 717 -- .../operations/_registries_operations.py | 2439 ---- .../operations/_replications_operations.py | 951 -- .../operations/_runs_operations.py | 673 - .../operations/_scope_maps_operations.py | 943 -- .../operations/_task_runs_operations.py | 984 -- .../operations/_tasks_operations.py | 838 -- .../operations/_tokens_operations.py | 942 -- .../operations/_webhooks_operations.py | 1262 -- .../generated_samples/agent_pools_create.py | 49 - .../generated_samples/agent_pools_delete.py | 43 - .../generated_samples/agent_pools_get.py | 44 - .../agent_pools_get_queue_status.py | 44 - .../generated_samples/agent_pools_list.py | 44 - .../generated_samples/agent_pools_update.py | 45 - .../generated_samples/cache_rule_create.py | 10 +- .../generated_samples/cache_rule_delete.py | 11 +- .../generated_samples/cache_rule_get.py | 11 +- .../generated_samples/cache_rule_list.py | 11 +- .../generated_samples/cache_rule_update.py | 10 +- .../connected_registry_create.py | 10 +- .../connected_registry_deactivate.py | 11 +- .../connected_registry_delete.py | 11 +- .../connected_registry_get.py | 11 +- .../connected_registry_list.py | 11 +- .../connected_registry_update.py | 10 +- .../credential_set_create.py | 11 +- .../credential_set_delete.py | 11 +- .../generated_samples/credential_set_get.py | 11 +- .../generated_samples/credential_set_list.py | 11 +- .../credential_set_update.py | 11 +- .../import_image_by_manifest_digest.py | 10 +- .../generated_samples/import_image_by_tag.py | 10 +- .../import_image_from_public_registry.py | 11 +- .../tasks_create_with_login_identity.py | 85 - ..._create_with_system_and_user_identities.py | 94 - .../tasks_create_with_system_identity.py | 84 - .../tasks_create_with_user_identities.py | 95 - ...pdate_with_key_vault_custom_credentials.py | 77 - .../tasks_update_with_login_identity.py | 63 - ...asks_update_with_msi_custom_credentials.py | 63 - .../generated_samples/operation_list.py | 9 +- ...te_endpoint_connection_create_or_update.py | 11 +- .../private_endpoint_connection_delete.py | 11 +- .../private_endpoint_connection_get.py | 11 +- .../private_endpoint_connection_list.py | 11 +- .../registries_get_build_source_upload_url.py | 43 - .../registries_schedule_run.py | 58 - ...egistries_schedule_run_encoded_task_run.py | 54 - .../registries_schedule_run_file_task_run.py | 55 - ...e_run_file_task_with_custom_credentials.py | 61 - .../registries_schedule_run_task.py | 60 - ...es_schedule_run_with_custom_credentials.py | 72 - ...gistries_schedule_run_with_log_template.py | 59 - .../registry_check_name_available.py | 11 +- .../registry_check_name_not_available.py | 11 +- .../generated_samples/registry_create.py | 11 +- .../generated_samples/registry_create_abac.py | 11 +- .../registry_create_zone_redundant.py | 11 +- .../generated_samples/registry_delete.py | 11 +- .../registry_generate_credentials.py | 10 +- .../generated_samples/registry_get.py | 11 +- .../registry_get_private_link_resource.py | 11 +- .../generated_samples/registry_list.py | 11 +- .../registry_list_by_resource_group.py | 11 +- .../registry_list_credentials.py | 11 +- .../registry_list_private_link_resources.py | 11 +- .../generated_samples/registry_list_usages.py | 11 +- .../registry_regenerate_credential.py | 11 +- .../generated_samples/registry_update.py | 11 +- .../generated_samples/replication_create.py | 11 +- .../replication_create_zone_redundant.py | 11 +- .../generated_samples/replication_delete.py | 11 +- .../generated_samples/replication_get.py | 11 +- .../generated_samples/replication_list.py | 11 +- .../generated_samples/replication_update.py | 11 +- .../generated_samples/runs_cancel.py | 43 - .../generated_samples/runs_get.py | 44 - .../generated_samples/runs_get_log_sas_url.py | 44 - .../generated_samples/runs_list.py | 44 - .../generated_samples/runs_update.py | 45 - .../generated_samples/scope_map_create.py | 11 +- .../generated_samples/scope_map_delete.py | 11 +- .../generated_samples/scope_map_get.py | 11 +- .../generated_samples/scope_map_list.py | 11 +- .../generated_samples/scope_map_update.py | 11 +- .../generated_samples/task_runs_create.py | 57 - .../generated_samples/task_runs_delete.py | 43 - .../generated_samples/task_runs_get.py | 44 - .../task_runs_get_details.py | 44 - .../generated_samples/task_runs_list.py | 44 - .../generated_samples/task_runs_update.py | 58 - .../generated_samples/tasks_create.py | 89 - .../tasks_create_quick_task.py | 50 - .../generated_samples/tasks_delete.py | 43 - .../generated_samples/tasks_get.py | 44 - .../generated_samples/tasks_get_details.py | 44 - .../generated_samples/tasks_list.py | 44 - .../generated_samples/tasks_update.py | 74 - .../tasks_update_quick_task.py | 48 - ...s_update_with_opaque_custom_credentials.py | 70 - .../generated_samples/token_create.py | 10 +- .../generated_samples/token_delete.py | 11 +- .../generated_samples/token_get.py | 11 +- .../generated_samples/token_list.py | 11 +- .../generated_samples/token_update.py | 10 +- .../generated_samples/webhook_create.py | 11 +- .../generated_samples/webhook_delete.py | 11 +- .../generated_samples/webhook_get.py | 11 +- .../webhook_get_callback_config.py | 11 +- .../generated_samples/webhook_list.py | 11 +- .../generated_samples/webhook_list_events.py | 11 +- .../generated_samples/webhook_ping.py | 11 +- .../generated_samples/webhook_update.py | 11 +- .../generated_tests/conftest.py | 30 +- ...tainer_registry_cache_rules_operations.py} | 49 +- ..._registry_cache_rules_operations_async.py} | 49 +- ...gistry_connected_registries_operations.py} | 118 +- ..._connected_registries_operations_async.py} | 122 +- ...er_registry_credential_sets_operations.py} | 77 +- ...istry_credential_sets_operations_async.py} | 77 +- ...istry_management_agent_pools_operations.py | 117 - ...management_agent_pools_operations_async.py | 124 - ..._management_archive_versions_operations.py | 78 - ...ement_archive_versions_operations_async.py | 83 - ...registry_management_archives_operations.py | 107 - ...ry_management_archives_operations_async.py | 112 - ..._management_export_pipelines_operations.py | 93 - ...ement_export_pipelines_operations_async.py | 98 - ..._management_import_pipelines_operations.py | 94 - ...ement_import_pipelines_operations_async.py | 99 - ...try_management_pipeline_runs_operations.py | 104 - ...nagement_pipeline_runs_operations_async.py | 109 - ...ner_registry_management_runs_operations.py | 84 - ...gistry_management_runs_operations_async.py | 85 - ...egistry_management_task_runs_operations.py | 178 - ...y_management_task_runs_operations_async.py | 183 - ...er_registry_management_tasks_operations.py | 221 - ...istry_management_tasks_operations_async.py | 222 - ... => test_container_registry_operations.py} | 12 +- ...st_container_registry_operations_async.py} | 12 +- ...rivate_endpoint_connections_operations.py} | 46 +- ..._endpoint_connections_operations_async.py} | 48 +- ...ntainer_registry_registries_operations.py} | 303 +- ...r_registry_registries_operations_async.py} | 313 +- ...ainer_registry_replications_operations.py} | 47 +- ...registry_replications_operations_async.py} | 47 +- ...ntainer_registry_scope_maps_operations.py} | 48 +- ...r_registry_scope_maps_operations_async.py} | 48 +- ...t_container_registry_tokens_operations.py} | 123 +- ...ainer_registry_tokens_operations_async.py} | 123 +- ...container_registry_webhooks_operations.py} | 70 +- ...ner_registry_webhooks_operations_async.py} | 70 +- .../pyproject.toml | 4 +- ...disable_test_cli_mgmt_containerregistry.py | 1 + ...est_cli_mgmt_containerregistry_registry.py | 1 + ...le_test_cli_mgmt_containerregistry_task.py | 1 + .../tsp-location.yaml | 4 + 201 files changed, 26749 insertions(+), 39291 deletions(-) rename sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/{_container_registry_management_client.py => _client.py} (79%) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/model_base.py rename sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/{_container_registry_management_client.py => _client.py} (80%) delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_agent_pools_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_cache_rules_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_connected_registries_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_credential_sets_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_registries_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_replications_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_scope_maps_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_task_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tasks_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tokens_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_webhooks_operations.py rename sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/{_container_registry_management_client_enums.py => _enums.py} (66%) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models_py3.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_agent_pools_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_cache_rules_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_connected_registries_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_credential_sets_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_registries_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_replications_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_scope_maps_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_task_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tasks_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tokens_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_webhooks_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_create.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_delete.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get_queue_status.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_list.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_update.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_login_identity.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_and_user_identities.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_identity.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_user_identities.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_key_vault_custom_credentials.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_login_identity.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_msi_custom_credentials.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_get_build_source_upload_url.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_encoded_task_run.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_run.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_with_custom_credentials.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_task.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_custom_credentials.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_log_template.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_cancel.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get_log_sas_url.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_list.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_update.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_create.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_delete.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get_details.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_list.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_update.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create_quick_task.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_delete.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get_details.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_list.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_quick_task.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_with_opaque_custom_credentials.py rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_cache_rules_operations.py => test_container_registry_cache_rules_operations.py} (80%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_cache_rules_operations_async.py => test_container_registry_cache_rules_operations_async.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_connected_registries_operations.py => test_container_registry_connected_registries_operations.py} (66%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_connected_registries_operations_async.py => test_container_registry_connected_registries_operations_async.py} (66%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_credential_sets_operations.py => test_container_registry_credential_sets_operations.py} (74%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_credential_sets_operations_async.py => test_container_registry_credential_sets_operations_async.py} (75%) delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations_async.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations.py delete mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations_async.py rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_operations.py => test_container_registry_operations.py} (70%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_operations_async.py => test_container_registry_operations_async.py} (70%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_private_endpoint_connections_operations.py => test_container_registry_private_endpoint_connections_operations.py} (82%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_private_endpoint_connections_operations_async.py => test_container_registry_private_endpoint_connections_operations_async.py} (80%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_registries_operations.py => test_container_registry_registries_operations.py} (54%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_registries_operations_async.py => test_container_registry_registries_operations_async.py} (54%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_replications_operations.py => test_container_registry_replications_operations.py} (80%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_replications_operations_async.py => test_container_registry_replications_operations_async.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_scope_maps_operations.py => test_container_registry_scope_maps_operations.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_scope_maps_operations_async.py => test_container_registry_scope_maps_operations_async.py} (82%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_tokens_operations.py => test_container_registry_tokens_operations.py} (61%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_tokens_operations_async.py => test_container_registry_tokens_operations_async.py} (61%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_webhooks_operations.py => test_container_registry_webhooks_operations.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_management_webhooks_operations_async.py => test_container_registry_webhooks_operations_async.py} (81%) create mode 100644 sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md index 7add5aca2575..51f0f3792f96 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md @@ -1,5 +1,86 @@ # Release History +## 15.0.0 (2026-01-21) + +### Features Added + + - Model `ConnectedRegistry` added property `properties` + - Model `CredentialSetUpdateParameters` added property `properties` + - Model `OperationDefinition` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `RegistryNameCheckRequest` added property `type` + - Model `RegistryUpdateParameters` added property `properties` + - Model `WebhookCreateParameters` added property `properties` + - Model `WebhookUpdateParameters` added property `properties` + - Added model `CacheRuleUpdateProperties` + - Added enum `ContainerRegistryResourceType` + - Added model `CredentialSetUpdateProperties` + - Added model `OperationPropertiesDefinition` + - Added model `RegistryPropertiesUpdateParameters` + - Added enum `RoleAssignmentMode` + - Added model `ScopeMapPropertiesUpdateParameters` + - Added model `TokenUpdateProperties` + - Added model `TrackedResource` + - Added model `WebhookPropertiesCreateParameters` + - Added model `WebhookPropertiesUpdateParameters` + +### Breaking Changes + + - Deleted or renamed client `ContainerRegistryManagementClient` + - Model `CacheRuleUpdateParameters` deleted or renamed its instance variable `credential_set_resource_id` + - Model `ConnectedRegistry` deleted or renamed its instance variable `provisioning_state` + - Model `ConnectedRegistry` deleted or renamed its instance variable `mode` + - Model `ConnectedRegistry` deleted or renamed its instance variable `version` + - Model `ConnectedRegistry` deleted or renamed its instance variable `connection_state` + - Model `ConnectedRegistry` deleted or renamed its instance variable `last_activity_time` + - Model `ConnectedRegistry` deleted or renamed its instance variable `activation` + - Model `ConnectedRegistry` deleted or renamed its instance variable `parent` + - Model `ConnectedRegistry` deleted or renamed its instance variable `client_token_ids` + - Model `ConnectedRegistry` deleted or renamed its instance variable `login_server` + - Model `ConnectedRegistry` deleted or renamed its instance variable `logging` + - Model `ConnectedRegistry` deleted or renamed its instance variable `status_details` + - Model `ConnectedRegistry` deleted or renamed its instance variable `notifications_list` + - Model `ConnectedRegistry` deleted or renamed its instance variable `garbage_collection` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `sync_properties` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `logging` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `client_token_ids` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `notifications_list` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `garbage_collection` + - Model `CredentialSetUpdateParameters` deleted or renamed its instance variable `auth_credentials` + - Model `OperationDefinition` deleted or renamed its instance variable `service_specification` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `admin_user_enabled` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_set` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `policies` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `encryption` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `data_endpoint_enabled` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `public_network_access` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_bypass_options` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `anonymous_pull_enabled` + - Model `Resource` deleted or renamed its instance variable `location` + - Model `Resource` deleted or renamed its instance variable `tags` + - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `description` + - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `actions` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `scope_map_id` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `status` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `credentials` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `service_uri` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `custom_headers` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `status` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `scope` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `actions` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `service_uri` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `custom_headers` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `status` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `scope` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `actions` + - Deleted or renamed model `ActiveDirectoryObject` + - Deleted or renamed model `ConnectedRegistryPropertiesActivation` + - Deleted or renamed model `ConnectedRegistryPropertiesAutoGenerated` + - Deleted or renamed model `ConnectedRegistryUpdateParametersProperties` + - Deleted or renamed model `LastModifiedByType` + - Deleted or renamed model `PackageType` + - Deleted or renamed model `StorageAccountProperties` + ## 14.1.0b4 (2025-12-05) ### Other Changes diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json index 3e77b90f482f..5294dd51030d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json @@ -1,11 +1,7 @@ { - "commit": "57c07d09696b4cffb1d23a6c9b6f4ff9212113f1", + "apiVersion": "2025-11-01", + "commit": "eb320d1d85f5b46c3cfe6cf60a1f0de4ef3b01d9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.43.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --package-mode=azure-mgmt --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2025-11-python --use=@autorest/python@6.43.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/readme.md" + "typespec_src": "specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry", + "emitterVersion": "0.57.1" } \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/apiview-properties.json b/sdk/containerregistry/azure-mgmt-containerregistry/apiview-properties.json index 2bec9b6d371f..2a81439b23ab 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/apiview-properties.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/apiview-properties.json @@ -1,374 +1,261 @@ { - "CrossLanguagePackageId": null, + "CrossLanguagePackageId": "Microsoft.ContainerRegistry", "CrossLanguageDefinitionId": { - "azure.mgmt.containerregistry.models.ActivationProperties": null, - "azure.mgmt.containerregistry.models.Actor": null, - "azure.mgmt.containerregistry.models.Resource": null, - "azure.mgmt.containerregistry.models.TrackedResource": null, - "azure.mgmt.containerregistry.models.AgentPool": null, - "azure.mgmt.containerregistry.models.AgentPoolListResult": null, - "azure.mgmt.containerregistry.models.AgentPoolQueueStatus": null, - "azure.mgmt.containerregistry.models.AgentPoolUpdateParameters": null, - "azure.mgmt.containerregistry.models.AgentProperties": null, - "azure.mgmt.containerregistry.models.Argument": null, - "azure.mgmt.containerregistry.models.AuthCredential": null, - "azure.mgmt.containerregistry.models.AuthInfo": null, - "azure.mgmt.containerregistry.models.AuthInfoUpdateParameters": null, - "azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicy": null, - "azure.mgmt.containerregistry.models.BaseImageDependency": null, - "azure.mgmt.containerregistry.models.BaseImageTrigger": null, - "azure.mgmt.containerregistry.models.BaseImageTriggerUpdateParameters": null, - "azure.mgmt.containerregistry.models.ProxyResource": null, - "azure.mgmt.containerregistry.models.CacheRule": null, - "azure.mgmt.containerregistry.models.CacheRulesListResult": null, - "azure.mgmt.containerregistry.models.CacheRuleUpdateParameters": null, - "azure.mgmt.containerregistry.models.CallbackConfig": null, - "azure.mgmt.containerregistry.models.ConnectedRegistry": null, - "azure.mgmt.containerregistry.models.ConnectedRegistryListResult": null, - "azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters": null, - "azure.mgmt.containerregistry.models.CredentialHealth": null, - "azure.mgmt.containerregistry.models.Credentials": null, - "azure.mgmt.containerregistry.models.CredentialSet": null, - "azure.mgmt.containerregistry.models.CredentialSetListResult": null, - "azure.mgmt.containerregistry.models.CredentialSetUpdateParameters": null, - "azure.mgmt.containerregistry.models.CustomRegistryCredentials": null, - "azure.mgmt.containerregistry.models.RunRequest": null, - "azure.mgmt.containerregistry.models.DockerBuildRequest": null, - "azure.mgmt.containerregistry.models.TaskStepProperties": null, - "azure.mgmt.containerregistry.models.DockerBuildStep": null, - "azure.mgmt.containerregistry.models.TaskStepUpdateParameters": null, - "azure.mgmt.containerregistry.models.DockerBuildStepUpdateParameters": null, - "azure.mgmt.containerregistry.models.EncodedTaskRunRequest": null, - "azure.mgmt.containerregistry.models.EncodedTaskStep": null, - "azure.mgmt.containerregistry.models.EncodedTaskStepUpdateParameters": null, - "azure.mgmt.containerregistry.models.EncryptionProperty": null, - "azure.mgmt.containerregistry.models.ErrorAdditionalInfo": null, - "azure.mgmt.containerregistry.models.ErrorDetail": null, - "azure.mgmt.containerregistry.models.ErrorResponse": null, - "azure.mgmt.containerregistry.models.EventInfo": null, - "azure.mgmt.containerregistry.models.Event": null, - "azure.mgmt.containerregistry.models.EventContent": null, - "azure.mgmt.containerregistry.models.EventListResult": null, - "azure.mgmt.containerregistry.models.EventRequestMessage": null, - "azure.mgmt.containerregistry.models.EventResponseMessage": null, - "azure.mgmt.containerregistry.models.ExportPolicy": null, - "azure.mgmt.containerregistry.models.FileTaskRunRequest": null, - "azure.mgmt.containerregistry.models.FileTaskStep": null, - "azure.mgmt.containerregistry.models.FileTaskStepUpdateParameters": null, - "azure.mgmt.containerregistry.models.GarbageCollectionProperties": null, - "azure.mgmt.containerregistry.models.GenerateCredentialsParameters": null, - "azure.mgmt.containerregistry.models.GenerateCredentialsResult": null, - "azure.mgmt.containerregistry.models.IdentityProperties": null, - "azure.mgmt.containerregistry.models.ImageDescriptor": null, - "azure.mgmt.containerregistry.models.ImageUpdateTrigger": null, - "azure.mgmt.containerregistry.models.ImportImageParameters": null, - "azure.mgmt.containerregistry.models.ImportSource": null, - "azure.mgmt.containerregistry.models.ImportSourceCredentials": null, - "azure.mgmt.containerregistry.models.IPRule": null, - "azure.mgmt.containerregistry.models.KeyVaultProperties": null, - "azure.mgmt.containerregistry.models.LoggingProperties": null, - "azure.mgmt.containerregistry.models.LoginServerProperties": null, - "azure.mgmt.containerregistry.models.NetworkRuleSet": null, - "azure.mgmt.containerregistry.models.OperationDefinition": null, - "azure.mgmt.containerregistry.models.OperationDisplayDefinition": null, - "azure.mgmt.containerregistry.models.OperationListResult": null, - "azure.mgmt.containerregistry.models.OperationLogSpecificationDefinition": null, - "azure.mgmt.containerregistry.models.OperationMetricSpecificationDefinition": null, - "azure.mgmt.containerregistry.models.OperationServiceSpecificationDefinition": null, - "azure.mgmt.containerregistry.models.OverrideTaskStepProperties": null, - "azure.mgmt.containerregistry.models.ParentProperties": null, - "azure.mgmt.containerregistry.models.PlatformProperties": null, - "azure.mgmt.containerregistry.models.PlatformUpdateParameters": null, - "azure.mgmt.containerregistry.models.Policies": null, - "azure.mgmt.containerregistry.models.PrivateEndpoint": null, - "azure.mgmt.containerregistry.models.PrivateEndpointConnection": null, - "azure.mgmt.containerregistry.models.PrivateEndpointConnectionListResult": null, - "azure.mgmt.containerregistry.models.PrivateLinkResource": null, - "azure.mgmt.containerregistry.models.PrivateLinkResourceListResult": null, - "azure.mgmt.containerregistry.models.PrivateLinkServiceConnectionState": null, - "azure.mgmt.containerregistry.models.QuarantinePolicy": null, - "azure.mgmt.containerregistry.models.RegenerateCredentialParameters": null, - "azure.mgmt.containerregistry.models.Registry": null, - "azure.mgmt.containerregistry.models.RegistryListCredentialsResult": null, - "azure.mgmt.containerregistry.models.RegistryListResult": null, - "azure.mgmt.containerregistry.models.RegistryNameCheckRequest": null, - "azure.mgmt.containerregistry.models.RegistryNameStatus": null, - "azure.mgmt.containerregistry.models.RegistryPassword": null, - "azure.mgmt.containerregistry.models.RegistryUpdateParameters": null, - "azure.mgmt.containerregistry.models.RegistryUsage": null, - "azure.mgmt.containerregistry.models.RegistryUsageListResult": null, - "azure.mgmt.containerregistry.models.Replication": null, - "azure.mgmt.containerregistry.models.ReplicationListResult": null, - "azure.mgmt.containerregistry.models.ReplicationUpdateParameters": null, - "azure.mgmt.containerregistry.models.Request": null, - "azure.mgmt.containerregistry.models.RetentionPolicy": null, - "azure.mgmt.containerregistry.models.Run": null, - "azure.mgmt.containerregistry.models.RunGetLogResult": null, - "azure.mgmt.containerregistry.models.RunListResult": null, - "azure.mgmt.containerregistry.models.RunUpdateParameters": null, - "azure.mgmt.containerregistry.models.ScopeMap": null, - "azure.mgmt.containerregistry.models.ScopeMapListResult": null, - "azure.mgmt.containerregistry.models.ScopeMapUpdateParameters": null, - "azure.mgmt.containerregistry.models.SecretObject": null, - "azure.mgmt.containerregistry.models.SetValue": null, - "azure.mgmt.containerregistry.models.Sku": null, - "azure.mgmt.containerregistry.models.Source": null, - "azure.mgmt.containerregistry.models.SourceProperties": null, - "azure.mgmt.containerregistry.models.SourceRegistryCredentials": null, - "azure.mgmt.containerregistry.models.SourceTrigger": null, - "azure.mgmt.containerregistry.models.SourceTriggerDescriptor": null, - "azure.mgmt.containerregistry.models.SourceTriggerUpdateParameters": null, - "azure.mgmt.containerregistry.models.SourceUpdateParameters": null, - "azure.mgmt.containerregistry.models.SourceUploadDefinition": null, - "azure.mgmt.containerregistry.models.Status": null, - "azure.mgmt.containerregistry.models.StatusDetailProperties": null, - "azure.mgmt.containerregistry.models.SyncProperties": null, - "azure.mgmt.containerregistry.models.SyncUpdateProperties": null, - "azure.mgmt.containerregistry.models.SystemData": null, - "azure.mgmt.containerregistry.models.Target": null, - "azure.mgmt.containerregistry.models.Task": null, - "azure.mgmt.containerregistry.models.TaskListResult": null, - "azure.mgmt.containerregistry.models.TaskRun": null, - "azure.mgmt.containerregistry.models.TaskRunListResult": null, - "azure.mgmt.containerregistry.models.TaskRunRequest": null, - "azure.mgmt.containerregistry.models.TaskRunUpdateParameters": null, - "azure.mgmt.containerregistry.models.TaskUpdateParameters": null, - "azure.mgmt.containerregistry.models.TimerTrigger": null, - "azure.mgmt.containerregistry.models.TimerTriggerDescriptor": null, - "azure.mgmt.containerregistry.models.TimerTriggerUpdateParameters": null, - "azure.mgmt.containerregistry.models.TlsCertificateProperties": null, - "azure.mgmt.containerregistry.models.TlsProperties": null, - "azure.mgmt.containerregistry.models.Token": null, - "azure.mgmt.containerregistry.models.TokenCertificate": null, - "azure.mgmt.containerregistry.models.TokenCredentialsProperties": null, - "azure.mgmt.containerregistry.models.TokenListResult": null, - "azure.mgmt.containerregistry.models.TokenPassword": null, - "azure.mgmt.containerregistry.models.TokenUpdateParameters": null, - "azure.mgmt.containerregistry.models.TriggerProperties": null, - "azure.mgmt.containerregistry.models.TriggerUpdateParameters": null, - "azure.mgmt.containerregistry.models.TrustPolicy": null, - "azure.mgmt.containerregistry.models.UserIdentityProperties": null, - "azure.mgmt.containerregistry.models.Webhook": null, - "azure.mgmt.containerregistry.models.WebhookCreateParameters": null, - "azure.mgmt.containerregistry.models.WebhookListResult": null, - "azure.mgmt.containerregistry.models.WebhookUpdateParameters": null, - "azure.mgmt.containerregistry.models.Action": null, - "azure.mgmt.containerregistry.models.CreatedByType": null, - "azure.mgmt.containerregistry.models.ConnectionStatus": null, - "azure.mgmt.containerregistry.models.ActionsRequired": null, - "azure.mgmt.containerregistry.models.ProvisioningState": null, - "azure.mgmt.containerregistry.models.SkuName": null, - "azure.mgmt.containerregistry.models.SkuTier": null, - "azure.mgmt.containerregistry.models.ResourceIdentityType": null, - "azure.mgmt.containerregistry.models.DefaultAction": null, - "azure.mgmt.containerregistry.models.PolicyStatus": null, - "azure.mgmt.containerregistry.models.TrustPolicyType": null, - "azure.mgmt.containerregistry.models.ExportPolicyStatus": null, - "azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicyStatus": null, - "azure.mgmt.containerregistry.models.EncryptionStatus": null, - "azure.mgmt.containerregistry.models.PublicNetworkAccess": null, - "azure.mgmt.containerregistry.models.NetworkRuleBypassOptions": null, - "azure.mgmt.containerregistry.models.ZoneRedundancy": null, - "azure.mgmt.containerregistry.models.AutoGeneratedDomainNameLabelScope": null, - "azure.mgmt.containerregistry.models.RoleAssignmentMode": null, - "azure.mgmt.containerregistry.models.ConnectedRegistryMode": null, - "azure.mgmt.containerregistry.models.ConnectionState": null, - "azure.mgmt.containerregistry.models.ActivationStatus": null, - "azure.mgmt.containerregistry.models.TlsStatus": null, - "azure.mgmt.containerregistry.models.CertificateType": null, - "azure.mgmt.containerregistry.models.LogLevel": null, - "azure.mgmt.containerregistry.models.AuditLogStatus": null, - "azure.mgmt.containerregistry.models.CredentialName": null, - "azure.mgmt.containerregistry.models.CredentialHealthStatus": null, - "azure.mgmt.containerregistry.models.TokenPasswordName": null, - "azure.mgmt.containerregistry.models.PasswordName": null, - "azure.mgmt.containerregistry.models.RegistryUsageUnit": null, - "azure.mgmt.containerregistry.models.TokenCertificateName": null, - "azure.mgmt.containerregistry.models.TokenStatus": null, - "azure.mgmt.containerregistry.models.WebhookAction": null, - "azure.mgmt.containerregistry.models.WebhookStatus": null, - "azure.mgmt.containerregistry.models.OS": null, - "azure.mgmt.containerregistry.models.RunStatus": null, - "azure.mgmt.containerregistry.models.RunType": null, - "azure.mgmt.containerregistry.models.Architecture": null, - "azure.mgmt.containerregistry.models.Variant": null, - "azure.mgmt.containerregistry.models.SourceRegistryLoginMode": null, - "azure.mgmt.containerregistry.models.SecretObjectType": null, - "azure.mgmt.containerregistry.models.BaseImageDependencyType": null, - "azure.mgmt.containerregistry.models.TriggerStatus": null, - "azure.mgmt.containerregistry.models.SourceTriggerEvent": null, - "azure.mgmt.containerregistry.models.SourceControlType": null, - "azure.mgmt.containerregistry.models.TokenType": null, - "azure.mgmt.containerregistry.models.TaskStatus": null, - "azure.mgmt.containerregistry.models.StepType": null, - "azure.mgmt.containerregistry.models.BaseImageTriggerType": null, - "azure.mgmt.containerregistry.models.UpdateTriggerPayloadType": null, - "azure.mgmt.containerregistry.models.ImportMode": null, - "azure.mgmt.containerregistry.operations.Operations.list": null, - "azure.mgmt.containerregistry.aio.operations.Operations.list": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.check_name_availability": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.check_name_availability": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.list_by_resource_group": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_by_resource_group": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.get": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_generate_credentials": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_generate_credentials": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_import_image": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_import_image": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.list_credentials": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_credentials": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.list_usages": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_usages": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.list_private_link_resources": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_private_link_resources": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.get_private_link_resource": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.get_private_link_resource": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.regenerate_credential": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.regenerate_credential": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.get_build_source_upload_url": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.get_build_source_upload_url": null, - "azure.mgmt.containerregistry.operations.RegistriesOperations.schedule_run": null, - "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.schedule_run": null, - "azure.mgmt.containerregistry.operations.CacheRulesOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.list": null, - "azure.mgmt.containerregistry.operations.CacheRulesOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.get": null, - "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.list": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.get": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_deactivate": null, - "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_deactivate": null, - "azure.mgmt.containerregistry.operations.CredentialSetsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.list": null, - "azure.mgmt.containerregistry.operations.CredentialSetsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.get": null, - "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.list": null, - "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.get": null, - "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": null, - "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": null, - "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.ReplicationsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.list": null, - "azure.mgmt.containerregistry.operations.ReplicationsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.get": null, - "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.ScopeMapsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.list": null, - "azure.mgmt.containerregistry.operations.ScopeMapsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.get": null, - "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.TokensOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.TokensOperations.list": null, - "azure.mgmt.containerregistry.operations.TokensOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.TokensOperations.get": null, - "azure.mgmt.containerregistry.operations.TokensOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.TokensOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.TokensOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.list": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.get": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.get_callback_config": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.get_callback_config": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.list_events": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.list_events": null, - "azure.mgmt.containerregistry.operations.WebhooksOperations.ping": null, - "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.ping": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.list": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.get": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.begin_delete": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.begin_delete": null, - "azure.mgmt.containerregistry.operations.AgentPoolsOperations.get_queue_status": null, - "azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations.get_queue_status": null, - "azure.mgmt.containerregistry.operations.RunsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.RunsOperations.list": null, - "azure.mgmt.containerregistry.operations.RunsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.RunsOperations.get": null, - "azure.mgmt.containerregistry.operations.RunsOperations.update": null, - "azure.mgmt.containerregistry.aio.operations.RunsOperations.update": null, - "azure.mgmt.containerregistry.operations.RunsOperations.cancel": null, - "azure.mgmt.containerregistry.aio.operations.RunsOperations.cancel": null, - "azure.mgmt.containerregistry.operations.RunsOperations.get_log_sas_url": null, - "azure.mgmt.containerregistry.aio.operations.RunsOperations.get_log_sas_url": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.list": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.get": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.begin_create": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.begin_create": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.begin_update": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.begin_update": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.delete": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.delete": null, - "azure.mgmt.containerregistry.operations.TaskRunsOperations.get_details": null, - "azure.mgmt.containerregistry.aio.operations.TaskRunsOperations.get_details": null, - "azure.mgmt.containerregistry.operations.TasksOperations.list": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.list": null, - "azure.mgmt.containerregistry.operations.TasksOperations.get": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.get": null, - "azure.mgmt.containerregistry.operations.TasksOperations.create": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.create": null, - "azure.mgmt.containerregistry.operations.TasksOperations.update": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.update": null, - "azure.mgmt.containerregistry.operations.TasksOperations.delete": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.delete": null, - "azure.mgmt.containerregistry.operations.TasksOperations.get_details": null, - "azure.mgmt.containerregistry.aio.operations.TasksOperations.get_details": null + "azure.mgmt.containerregistry.models.ActivationProperties": "Microsoft.ContainerRegistry.ActivationProperties", + "azure.mgmt.containerregistry.models.Actor": "Microsoft.ContainerRegistry.Actor", + "azure.mgmt.containerregistry.models.AuthCredential": "Microsoft.ContainerRegistry.AuthCredential", + "azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicy": "Microsoft.ContainerRegistry.AzureADAuthenticationAsArmPolicy", + "azure.mgmt.containerregistry.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.containerregistry.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.containerregistry.models.CacheRule": "Microsoft.ContainerRegistry.CacheRule", + "azure.mgmt.containerregistry.models.CacheRuleProperties": "Microsoft.ContainerRegistry.CacheRuleProperties", + "azure.mgmt.containerregistry.models.CacheRuleUpdateParameters": "Microsoft.ContainerRegistry.CacheRuleUpdateParameters", + "azure.mgmt.containerregistry.models.CacheRuleUpdateProperties": "Microsoft.ContainerRegistry.CacheRuleUpdateProperties", + "azure.mgmt.containerregistry.models.CallbackConfig": "Microsoft.ContainerRegistry.CallbackConfig", + "azure.mgmt.containerregistry.models.ConnectedRegistry": "Microsoft.ContainerRegistry.ConnectedRegistry", + "azure.mgmt.containerregistry.models.ConnectedRegistryProperties": "Microsoft.ContainerRegistry.ConnectedRegistryProperties", + "azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters": "Microsoft.ContainerRegistry.ConnectedRegistryUpdateParameters", + "azure.mgmt.containerregistry.models.ConnectedRegistryUpdateProperties": "Microsoft.ContainerRegistry.ConnectedRegistryUpdateProperties", + "azure.mgmt.containerregistry.models.CredentialHealth": "Microsoft.ContainerRegistry.CredentialHealth", + "azure.mgmt.containerregistry.models.CredentialSet": "Microsoft.ContainerRegistry.CredentialSet", + "azure.mgmt.containerregistry.models.CredentialSetProperties": "Microsoft.ContainerRegistry.CredentialSetProperties", + "azure.mgmt.containerregistry.models.CredentialSetUpdateParameters": "Microsoft.ContainerRegistry.CredentialSetUpdateParameters", + "azure.mgmt.containerregistry.models.CredentialSetUpdateProperties": "Microsoft.ContainerRegistry.CredentialSetUpdateProperties", + "azure.mgmt.containerregistry.models.EncryptionProperty": "Microsoft.ContainerRegistry.EncryptionProperty", + "azure.mgmt.containerregistry.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.containerregistry.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.containerregistry.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.containerregistry.models.EventInfo": "Microsoft.ContainerRegistry.EventInfo", + "azure.mgmt.containerregistry.models.Event": "Microsoft.ContainerRegistry.Event", + "azure.mgmt.containerregistry.models.EventContent": "Microsoft.ContainerRegistry.EventContent", + "azure.mgmt.containerregistry.models.EventRequestMessage": "Microsoft.ContainerRegistry.EventRequestMessage", + "azure.mgmt.containerregistry.models.EventResponseMessage": "Microsoft.ContainerRegistry.EventResponseMessage", + "azure.mgmt.containerregistry.models.ExportPolicy": "Microsoft.ContainerRegistry.ExportPolicy", + "azure.mgmt.containerregistry.models.GarbageCollectionProperties": "Microsoft.ContainerRegistry.GarbageCollectionProperties", + "azure.mgmt.containerregistry.models.GenerateCredentialsParameters": "Microsoft.ContainerRegistry.GenerateCredentialsParameters", + "azure.mgmt.containerregistry.models.GenerateCredentialsResult": "Microsoft.ContainerRegistry.GenerateCredentialsResult", + "azure.mgmt.containerregistry.models.IdentityProperties": "Microsoft.ContainerRegistry.IdentityProperties", + "azure.mgmt.containerregistry.models.ImportImageParameters": "Microsoft.ContainerRegistry.ImportImageParameters", + "azure.mgmt.containerregistry.models.ImportSource": "Microsoft.ContainerRegistry.ImportSource", + "azure.mgmt.containerregistry.models.ImportSourceCredentials": "Microsoft.ContainerRegistry.ImportSourceCredentials", + "azure.mgmt.containerregistry.models.IPRule": "Microsoft.ContainerRegistry.IPRule", + "azure.mgmt.containerregistry.models.KeyVaultProperties": "Microsoft.ContainerRegistry.KeyVaultProperties", + "azure.mgmt.containerregistry.models.LoggingProperties": "Microsoft.ContainerRegistry.LoggingProperties", + "azure.mgmt.containerregistry.models.LoginServerProperties": "Microsoft.ContainerRegistry.LoginServerProperties", + "azure.mgmt.containerregistry.models.NetworkRuleSet": "Microsoft.ContainerRegistry.NetworkRuleSet", + "azure.mgmt.containerregistry.models.OperationDefinition": "Microsoft.ContainerRegistry.OperationDefinition", + "azure.mgmt.containerregistry.models.OperationDisplayDefinition": "Microsoft.ContainerRegistry.OperationDisplayDefinition", + "azure.mgmt.containerregistry.models.OperationLogSpecificationDefinition": "Microsoft.ContainerRegistry.OperationLogSpecificationDefinition", + "azure.mgmt.containerregistry.models.OperationMetricSpecificationDefinition": "Microsoft.ContainerRegistry.OperationMetricSpecificationDefinition", + "azure.mgmt.containerregistry.models.OperationPropertiesDefinition": "Microsoft.ContainerRegistry.OperationPropertiesDefinition", + "azure.mgmt.containerregistry.models.OperationServiceSpecificationDefinition": "Microsoft.ContainerRegistry.OperationServiceSpecificationDefinition", + "azure.mgmt.containerregistry.models.ParentProperties": "Microsoft.ContainerRegistry.ParentProperties", + "azure.mgmt.containerregistry.models.Policies": "Microsoft.ContainerRegistry.Policies", + "azure.mgmt.containerregistry.models.PrivateEndpoint": "Microsoft.ContainerRegistry.PrivateEndpoint", + "azure.mgmt.containerregistry.models.PrivateEndpointConnection": "Microsoft.ContainerRegistry.PrivateEndpointConnection", + "azure.mgmt.containerregistry.models.PrivateEndpointConnectionProperties": "Microsoft.ContainerRegistry.PrivateEndpointConnectionProperties", + "azure.mgmt.containerregistry.models.PrivateLinkResource": "Azure.ResourceManager.CommonTypes.PrivateLinkResource", + "azure.mgmt.containerregistry.models.PrivateLinkResourceProperties": "Azure.ResourceManager.CommonTypes.PrivateLinkResourceProperties", + "azure.mgmt.containerregistry.models.PrivateLinkServiceConnectionState": "Microsoft.ContainerRegistry.PrivateLinkServiceConnectionState", + "azure.mgmt.containerregistry.models.QuarantinePolicy": "Microsoft.ContainerRegistry.QuarantinePolicy", + "azure.mgmt.containerregistry.models.RegenerateCredentialParameters": "Microsoft.ContainerRegistry.RegenerateCredentialParameters", + "azure.mgmt.containerregistry.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.containerregistry.models.Registry": "Microsoft.ContainerRegistry.Registry", + "azure.mgmt.containerregistry.models.RegistryListCredentialsResult": "Microsoft.ContainerRegistry.RegistryListCredentialsResult", + "azure.mgmt.containerregistry.models.RegistryNameCheckRequest": "Microsoft.ContainerRegistry.RegistryNameCheckRequest", + "azure.mgmt.containerregistry.models.RegistryNameStatus": "Microsoft.ContainerRegistry.RegistryNameStatus", + "azure.mgmt.containerregistry.models.RegistryPassword": "Microsoft.ContainerRegistry.RegistryPassword", + "azure.mgmt.containerregistry.models.RegistryProperties": "Microsoft.ContainerRegistry.RegistryProperties", + "azure.mgmt.containerregistry.models.RegistryPropertiesUpdateParameters": "Microsoft.ContainerRegistry.RegistryPropertiesUpdateParameters", + "azure.mgmt.containerregistry.models.RegistryUpdateParameters": "Microsoft.ContainerRegistry.RegistryUpdateParameters", + "azure.mgmt.containerregistry.models.RegistryUsage": "Microsoft.ContainerRegistry.RegistryUsage", + "azure.mgmt.containerregistry.models.RegistryUsageListResult": "Microsoft.ContainerRegistry.RegistryUsageListResult", + "azure.mgmt.containerregistry.models.Replication": "Microsoft.ContainerRegistry.Replication", + "azure.mgmt.containerregistry.models.ReplicationProperties": "Microsoft.ContainerRegistry.ReplicationProperties", + "azure.mgmt.containerregistry.models.ReplicationUpdateParameters": "Microsoft.ContainerRegistry.ReplicationUpdateParameters", + "azure.mgmt.containerregistry.models.ReplicationUpdateParametersProperties": "Microsoft.ContainerRegistry.ReplicationUpdateParametersProperties", + "azure.mgmt.containerregistry.models.Request": "Microsoft.ContainerRegistry.Request", + "azure.mgmt.containerregistry.models.RetentionPolicy": "Microsoft.ContainerRegistry.RetentionPolicy", + "azure.mgmt.containerregistry.models.ScopeMap": "Microsoft.ContainerRegistry.ScopeMap", + "azure.mgmt.containerregistry.models.ScopeMapProperties": "Microsoft.ContainerRegistry.ScopeMapProperties", + "azure.mgmt.containerregistry.models.ScopeMapPropertiesUpdateParameters": "Microsoft.ContainerRegistry.ScopeMapPropertiesUpdateParameters", + "azure.mgmt.containerregistry.models.ScopeMapUpdateParameters": "Microsoft.ContainerRegistry.ScopeMapUpdateParameters", + "azure.mgmt.containerregistry.models.Sku": "Microsoft.ContainerRegistry.Sku", + "azure.mgmt.containerregistry.models.Source": "Microsoft.ContainerRegistry.Source", + "azure.mgmt.containerregistry.models.Status": "Microsoft.ContainerRegistry.Status", + "azure.mgmt.containerregistry.models.StatusDetailProperties": "Microsoft.ContainerRegistry.StatusDetailProperties", + "azure.mgmt.containerregistry.models.SyncProperties": "Microsoft.ContainerRegistry.SyncProperties", + "azure.mgmt.containerregistry.models.SyncUpdateProperties": "Microsoft.ContainerRegistry.SyncUpdateProperties", + "azure.mgmt.containerregistry.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.containerregistry.models.Target": "Microsoft.ContainerRegistry.Target", + "azure.mgmt.containerregistry.models.TlsCertificateProperties": "Microsoft.ContainerRegistry.TlsCertificateProperties", + "azure.mgmt.containerregistry.models.TlsProperties": "Microsoft.ContainerRegistry.TlsProperties", + "azure.mgmt.containerregistry.models.Token": "Microsoft.ContainerRegistry.Token", + "azure.mgmt.containerregistry.models.TokenCertificate": "Microsoft.ContainerRegistry.TokenCertificate", + "azure.mgmt.containerregistry.models.TokenCredentialsProperties": "Microsoft.ContainerRegistry.TokenCredentialsProperties", + "azure.mgmt.containerregistry.models.TokenPassword": "Microsoft.ContainerRegistry.TokenPassword", + "azure.mgmt.containerregistry.models.TokenProperties": "Microsoft.ContainerRegistry.TokenProperties", + "azure.mgmt.containerregistry.models.TokenUpdateParameters": "Microsoft.ContainerRegistry.TokenUpdateParameters", + "azure.mgmt.containerregistry.models.TokenUpdateProperties": "Microsoft.ContainerRegistry.TokenUpdateProperties", + "azure.mgmt.containerregistry.models.TrustPolicy": "Microsoft.ContainerRegistry.TrustPolicy", + "azure.mgmt.containerregistry.models.UserIdentityProperties": "Microsoft.ContainerRegistry.UserIdentityProperties", + "azure.mgmt.containerregistry.models.Webhook": "Microsoft.ContainerRegistry.Webhook", + "azure.mgmt.containerregistry.models.WebhookCreateParameters": "Microsoft.ContainerRegistry.WebhookCreateParameters", + "azure.mgmt.containerregistry.models.WebhookProperties": "Microsoft.ContainerRegistry.WebhookProperties", + "azure.mgmt.containerregistry.models.WebhookPropertiesCreateParameters": "Microsoft.ContainerRegistry.WebhookPropertiesCreateParameters", + "azure.mgmt.containerregistry.models.WebhookPropertiesUpdateParameters": "Microsoft.ContainerRegistry.WebhookPropertiesUpdateParameters", + "azure.mgmt.containerregistry.models.WebhookUpdateParameters": "Microsoft.ContainerRegistry.WebhookUpdateParameters", + "azure.mgmt.containerregistry.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.containerregistry.models.ProvisioningState": "Microsoft.ContainerRegistry.ProvisioningState", + "azure.mgmt.containerregistry.models.DefaultAction": "Microsoft.ContainerRegistry.DefaultAction", + "azure.mgmt.containerregistry.models.Action": "Microsoft.ContainerRegistry.Action", + "azure.mgmt.containerregistry.models.PolicyStatus": "Microsoft.ContainerRegistry.PolicyStatus", + "azure.mgmt.containerregistry.models.TrustPolicyType": "Microsoft.ContainerRegistry.TrustPolicyType", + "azure.mgmt.containerregistry.models.ExportPolicyStatus": "Microsoft.ContainerRegistry.ExportPolicyStatus", + "azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicyStatus": "Microsoft.ContainerRegistry.AzureADAuthenticationAsArmPolicyStatus", + "azure.mgmt.containerregistry.models.EncryptionStatus": "Microsoft.ContainerRegistry.EncryptionStatus", + "azure.mgmt.containerregistry.models.ConnectionStatus": "Microsoft.ContainerRegistry.ConnectionStatus", + "azure.mgmt.containerregistry.models.ActionsRequired": "Microsoft.ContainerRegistry.ActionsRequired", + "azure.mgmt.containerregistry.models.PublicNetworkAccess": "Microsoft.ContainerRegistry.PublicNetworkAccess", + "azure.mgmt.containerregistry.models.NetworkRuleBypassOptions": "Microsoft.ContainerRegistry.NetworkRuleBypassOptions", + "azure.mgmt.containerregistry.models.ZoneRedundancy": "Microsoft.ContainerRegistry.ZoneRedundancy", + "azure.mgmt.containerregistry.models.RoleAssignmentMode": "Microsoft.ContainerRegistry.RoleAssignmentMode", + "azure.mgmt.containerregistry.models.SkuName": "Microsoft.ContainerRegistry.SkuName", + "azure.mgmt.containerregistry.models.SkuTier": "Microsoft.ContainerRegistry.SkuTier", + "azure.mgmt.containerregistry.models.ResourceIdentityType": "Microsoft.ContainerRegistry.ResourceIdentityType", + "azure.mgmt.containerregistry.models.ImportMode": "Microsoft.ContainerRegistry.ImportMode", + "azure.mgmt.containerregistry.models.RegistryUsageUnit": "Microsoft.ContainerRegistry.RegistryUsageUnit", + "azure.mgmt.containerregistry.models.PasswordName": "Microsoft.ContainerRegistry.PasswordName", + "azure.mgmt.containerregistry.models.TokenPasswordName": "Microsoft.ContainerRegistry.TokenPasswordName", + "azure.mgmt.containerregistry.models.ContainerRegistryResourceType": "Microsoft.ContainerRegistry.ContainerRegistryResourceType", + "azure.mgmt.containerregistry.models.CredentialName": "Microsoft.ContainerRegistry.CredentialName", + "azure.mgmt.containerregistry.models.CredentialHealthStatus": "Microsoft.ContainerRegistry.CredentialHealthStatus", + "azure.mgmt.containerregistry.models.ConnectedRegistryMode": "Microsoft.ContainerRegistry.ConnectedRegistryMode", + "azure.mgmt.containerregistry.models.ConnectionState": "Microsoft.ContainerRegistry.ConnectionState", + "azure.mgmt.containerregistry.models.ActivationStatus": "Microsoft.ContainerRegistry.ActivationStatus", + "azure.mgmt.containerregistry.models.TlsStatus": "Microsoft.ContainerRegistry.TlsStatus", + "azure.mgmt.containerregistry.models.CertificateType": "Microsoft.ContainerRegistry.CertificateType", + "azure.mgmt.containerregistry.models.LogLevel": "Microsoft.ContainerRegistry.LogLevel", + "azure.mgmt.containerregistry.models.AuditLogStatus": "Microsoft.ContainerRegistry.AuditLogStatus", + "azure.mgmt.containerregistry.models.TokenCertificateName": "Microsoft.ContainerRegistry.TokenCertificateName", + "azure.mgmt.containerregistry.models.TokenStatus": "Microsoft.ContainerRegistry.TokenStatus", + "azure.mgmt.containerregistry.models.WebhookStatus": "Microsoft.ContainerRegistry.WebhookStatus", + "azure.mgmt.containerregistry.models.WebhookAction": "Microsoft.ContainerRegistry.WebhookAction", + "azure.mgmt.containerregistry.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.containerregistry.aio.operations.Operations.list": "Azure.ResourceManager.Legacy.Operations.list", + "azure.mgmt.containerregistry.operations.RegistriesOperations.get": "Microsoft.ContainerRegistry.Registries.get", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.get": "Microsoft.ContainerRegistry.Registries.get", + "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_create": "Microsoft.ContainerRegistry.Registries.create", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_create": "Microsoft.ContainerRegistry.Registries.create", + "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_update": "Microsoft.ContainerRegistry.Registries.update", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_update": "Microsoft.ContainerRegistry.Registries.update", + "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_delete": "Microsoft.ContainerRegistry.Registries.delete", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_delete": "Microsoft.ContainerRegistry.Registries.delete", + "azure.mgmt.containerregistry.operations.RegistriesOperations.list_by_resource_group": "Microsoft.ContainerRegistry.Registries.listByResourceGroup", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_by_resource_group": "Microsoft.ContainerRegistry.Registries.listByResourceGroup", + "azure.mgmt.containerregistry.operations.RegistriesOperations.list": "Microsoft.ContainerRegistry.Registries.list", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list": "Microsoft.ContainerRegistry.Registries.list", + "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_import_image": "Microsoft.ContainerRegistry.Registries.importImage", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_import_image": "Microsoft.ContainerRegistry.Registries.importImage", + "azure.mgmt.containerregistry.operations.RegistriesOperations.list_usages": "Microsoft.ContainerRegistry.Registries.listUsages", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_usages": "Microsoft.ContainerRegistry.Registries.listUsages", + "azure.mgmt.containerregistry.operations.RegistriesOperations.list_credentials": "Microsoft.ContainerRegistry.Registries.listCredentials", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_credentials": "Microsoft.ContainerRegistry.Registries.listCredentials", + "azure.mgmt.containerregistry.operations.RegistriesOperations.regenerate_credential": "Microsoft.ContainerRegistry.Registries.regenerateCredential", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.regenerate_credential": "Microsoft.ContainerRegistry.Registries.regenerateCredential", + "azure.mgmt.containerregistry.operations.RegistriesOperations.begin_generate_credentials": "Microsoft.ContainerRegistry.Registries.generateCredentials", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.begin_generate_credentials": "Microsoft.ContainerRegistry.Registries.generateCredentials", + "azure.mgmt.containerregistry.operations.RegistriesOperations.check_name_availability": "Microsoft.ContainerRegistry.Registries.checkNameAvailability", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.check_name_availability": "Microsoft.ContainerRegistry.Registries.checkNameAvailability", + "azure.mgmt.containerregistry.operations.RegistriesOperations.get_private_link_resource": "Microsoft.ContainerRegistry.PrivateLinkResources.getPrivateLinkResource", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.get_private_link_resource": "Microsoft.ContainerRegistry.PrivateLinkResources.getPrivateLinkResource", + "azure.mgmt.containerregistry.operations.RegistriesOperations.list_private_link_resources": "Microsoft.ContainerRegistry.PrivateLinkResources.listPrivateLinkResources", + "azure.mgmt.containerregistry.aio.operations.RegistriesOperations.list_private_link_resources": "Microsoft.ContainerRegistry.PrivateLinkResources.listPrivateLinkResources", + "azure.mgmt.containerregistry.operations.CacheRulesOperations.get": "Microsoft.ContainerRegistry.CacheRules.get", + "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.get": "Microsoft.ContainerRegistry.CacheRules.get", + "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_create": "Microsoft.ContainerRegistry.CacheRules.create", + "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_create": "Microsoft.ContainerRegistry.CacheRules.create", + "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_update": "Microsoft.ContainerRegistry.CacheRules.update", + "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_update": "Microsoft.ContainerRegistry.CacheRules.update", + "azure.mgmt.containerregistry.operations.CacheRulesOperations.begin_delete": "Microsoft.ContainerRegistry.CacheRules.delete", + "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.begin_delete": "Microsoft.ContainerRegistry.CacheRules.delete", + "azure.mgmt.containerregistry.operations.CacheRulesOperations.list": "Microsoft.ContainerRegistry.CacheRules.list", + "azure.mgmt.containerregistry.aio.operations.CacheRulesOperations.list": "Microsoft.ContainerRegistry.CacheRules.list", + "azure.mgmt.containerregistry.operations.CredentialSetsOperations.get": "Microsoft.ContainerRegistry.CredentialSets.get", + "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.get": "Microsoft.ContainerRegistry.CredentialSets.get", + "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_create": "Microsoft.ContainerRegistry.CredentialSets.create", + "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_create": "Microsoft.ContainerRegistry.CredentialSets.create", + "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_update": "Microsoft.ContainerRegistry.CredentialSets.update", + "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_update": "Microsoft.ContainerRegistry.CredentialSets.update", + "azure.mgmt.containerregistry.operations.CredentialSetsOperations.begin_delete": "Microsoft.ContainerRegistry.CredentialSets.delete", + "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.begin_delete": "Microsoft.ContainerRegistry.CredentialSets.delete", + "azure.mgmt.containerregistry.operations.CredentialSetsOperations.list": "Microsoft.ContainerRegistry.CredentialSets.list", + "azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations.list": "Microsoft.ContainerRegistry.CredentialSets.list", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.get": "Microsoft.ContainerRegistry.ConnectedRegistries.get", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.get": "Microsoft.ContainerRegistry.ConnectedRegistries.get", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_create": "Microsoft.ContainerRegistry.ConnectedRegistries.create", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_create": "Microsoft.ContainerRegistry.ConnectedRegistries.create", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_update": "Microsoft.ContainerRegistry.ConnectedRegistries.update", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_update": "Microsoft.ContainerRegistry.ConnectedRegistries.update", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_delete": "Microsoft.ContainerRegistry.ConnectedRegistries.delete", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_delete": "Microsoft.ContainerRegistry.ConnectedRegistries.delete", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.list": "Microsoft.ContainerRegistry.ConnectedRegistries.list", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.list": "Microsoft.ContainerRegistry.ConnectedRegistries.list", + "azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations.begin_deactivate": "Microsoft.ContainerRegistry.ConnectedRegistries.deactivate", + "azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations.begin_deactivate": "Microsoft.ContainerRegistry.ConnectedRegistries.deactivate", + "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.ContainerRegistry.PrivateEndpointConnections.get", + "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.ContainerRegistry.PrivateEndpointConnections.get", + "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.ContainerRegistry.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.ContainerRegistry.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.ContainerRegistry.PrivateEndpointConnections.delete", + "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.ContainerRegistry.PrivateEndpointConnections.delete", + "azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.ContainerRegistry.PrivateEndpointConnections.list", + "azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations.list": "Microsoft.ContainerRegistry.PrivateEndpointConnections.list", + "azure.mgmt.containerregistry.operations.ReplicationsOperations.get": "Microsoft.ContainerRegistry.Replications.get", + "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.get": "Microsoft.ContainerRegistry.Replications.get", + "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_create": "Microsoft.ContainerRegistry.Replications.create", + "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_create": "Microsoft.ContainerRegistry.Replications.create", + "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_update": "Microsoft.ContainerRegistry.Replications.update", + "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_update": "Microsoft.ContainerRegistry.Replications.update", + "azure.mgmt.containerregistry.operations.ReplicationsOperations.begin_delete": "Microsoft.ContainerRegistry.Replications.delete", + "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.begin_delete": "Microsoft.ContainerRegistry.Replications.delete", + "azure.mgmt.containerregistry.operations.ReplicationsOperations.list": "Microsoft.ContainerRegistry.Replications.list", + "azure.mgmt.containerregistry.aio.operations.ReplicationsOperations.list": "Microsoft.ContainerRegistry.Replications.list", + "azure.mgmt.containerregistry.operations.ScopeMapsOperations.get": "Microsoft.ContainerRegistry.ScopeMaps.get", + "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.get": "Microsoft.ContainerRegistry.ScopeMaps.get", + "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_create": "Microsoft.ContainerRegistry.ScopeMaps.create", + "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_create": "Microsoft.ContainerRegistry.ScopeMaps.create", + "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_update": "Microsoft.ContainerRegistry.ScopeMaps.update", + "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_update": "Microsoft.ContainerRegistry.ScopeMaps.update", + "azure.mgmt.containerregistry.operations.ScopeMapsOperations.begin_delete": "Microsoft.ContainerRegistry.ScopeMaps.delete", + "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.begin_delete": "Microsoft.ContainerRegistry.ScopeMaps.delete", + "azure.mgmt.containerregistry.operations.ScopeMapsOperations.list": "Microsoft.ContainerRegistry.ScopeMaps.list", + "azure.mgmt.containerregistry.aio.operations.ScopeMapsOperations.list": "Microsoft.ContainerRegistry.ScopeMaps.list", + "azure.mgmt.containerregistry.operations.TokensOperations.get": "Microsoft.ContainerRegistry.Tokens.get", + "azure.mgmt.containerregistry.aio.operations.TokensOperations.get": "Microsoft.ContainerRegistry.Tokens.get", + "azure.mgmt.containerregistry.operations.TokensOperations.begin_create": "Microsoft.ContainerRegistry.Tokens.create", + "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_create": "Microsoft.ContainerRegistry.Tokens.create", + "azure.mgmt.containerregistry.operations.TokensOperations.begin_update": "Microsoft.ContainerRegistry.Tokens.update", + "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_update": "Microsoft.ContainerRegistry.Tokens.update", + "azure.mgmt.containerregistry.operations.TokensOperations.begin_delete": "Microsoft.ContainerRegistry.Tokens.delete", + "azure.mgmt.containerregistry.aio.operations.TokensOperations.begin_delete": "Microsoft.ContainerRegistry.Tokens.delete", + "azure.mgmt.containerregistry.operations.TokensOperations.list": "Microsoft.ContainerRegistry.Tokens.list", + "azure.mgmt.containerregistry.aio.operations.TokensOperations.list": "Microsoft.ContainerRegistry.Tokens.list", + "azure.mgmt.containerregistry.operations.WebhooksOperations.get": "Microsoft.ContainerRegistry.Webhooks.get", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.get": "Microsoft.ContainerRegistry.Webhooks.get", + "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_create": "Microsoft.ContainerRegistry.Webhooks.create", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_create": "Microsoft.ContainerRegistry.Webhooks.create", + "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_update": "Microsoft.ContainerRegistry.Webhooks.update", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_update": "Microsoft.ContainerRegistry.Webhooks.update", + "azure.mgmt.containerregistry.operations.WebhooksOperations.begin_delete": "Microsoft.ContainerRegistry.Webhooks.delete", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.begin_delete": "Microsoft.ContainerRegistry.Webhooks.delete", + "azure.mgmt.containerregistry.operations.WebhooksOperations.list": "Microsoft.ContainerRegistry.Webhooks.list", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.list": "Microsoft.ContainerRegistry.Webhooks.list", + "azure.mgmt.containerregistry.operations.WebhooksOperations.ping": "Microsoft.ContainerRegistry.Webhooks.ping", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.ping": "Microsoft.ContainerRegistry.Webhooks.ping", + "azure.mgmt.containerregistry.operations.WebhooksOperations.list_events": "Microsoft.ContainerRegistry.Webhooks.listEvents", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.list_events": "Microsoft.ContainerRegistry.Webhooks.listEvents", + "azure.mgmt.containerregistry.operations.WebhooksOperations.get_callback_config": "Microsoft.ContainerRegistry.Webhooks.getCallbackConfig", + "azure.mgmt.containerregistry.aio.operations.WebhooksOperations.get_callback_config": "Microsoft.ContainerRegistry.Webhooks.getCallbackConfig" } } \ No newline at end of file diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py index 8094e33eefa7..36f67ce7b7c1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._container_registry_management_client import ContainerRegistryManagementClient # type: ignore +from ._client import ContainerRegistryClient # type: ignore from ._version import VERSION __version__ = VERSION @@ -25,7 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ContainerRegistryManagementClient", + "ContainerRegistryClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore 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/_client.py similarity index 79% rename from sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py rename to sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py index dcf4f8123a4e..531e18041ecb 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_container_registry_management_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,11 +17,9 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models -from ._configuration import ContainerRegistryManagementClientConfiguration +from ._configuration import ContainerRegistryClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( - AgentPoolsOperations, CacheRulesOperations, ConnectedRegistriesOperations, CredentialSetsOperations, @@ -30,10 +27,7 @@ PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, - RunsOperations, ScopeMapsOperations, - TaskRunsOperations, - TasksOperations, TokensOperations, WebhooksOperations, ) @@ -43,7 +37,7 @@ from azure.core.credentials import TokenCredential -class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ContainerRegistryClient: # pylint: disable=too-many-instance-attributes """The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. @@ -54,11 +48,11 @@ class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-v :vartype registries: azure.mgmt.containerregistry.operations.RegistriesOperations :ivar cache_rules: CacheRulesOperations operations :vartype cache_rules: azure.mgmt.containerregistry.operations.CacheRulesOperations + :ivar credential_sets: CredentialSetsOperations operations + :vartype credential_sets: azure.mgmt.containerregistry.operations.CredentialSetsOperations :ivar connected_registries: ConnectedRegistriesOperations operations :vartype connected_registries: azure.mgmt.containerregistry.operations.ConnectedRegistriesOperations - :ivar credential_sets: CredentialSetsOperations operations - :vartype credential_sets: azure.mgmt.containerregistry.operations.CredentialSetsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerregistry.operations.PrivateEndpointConnectionsOperations @@ -70,23 +64,18 @@ class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-v :vartype tokens: azure.mgmt.containerregistry.operations.TokensOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.operations.WebhooksOperations - :ivar agent_pools: AgentPoolsOperations operations - :vartype agent_pools: azure.mgmt.containerregistry.operations.AgentPoolsOperations - :ivar runs: RunsOperations operations - :vartype runs: azure.mgmt.containerregistry.operations.RunsOperations - :ivar task_runs: TaskRunsOperations operations - :vartype task_runs: azure.mgmt.containerregistry.operations.TaskRunsOperations - :ivar tasks: TasksOperations operations - :vartype tasks: azure.mgmt.containerregistry.operations.TasksOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-11-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -100,14 +89,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ContainerRegistryManagementClientConfiguration( + self._config = ContainerRegistryClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -131,19 +122,18 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, base_url), policies=_policies, **kwargs) + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.cache_rules = CacheRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.credential_sets = CredentialSetsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_registries = ConnectedRegistriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.credential_sets = CredentialSetsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -151,18 +141,14 @@ def __init__( 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.agent_pools = AgentPoolsOperations(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, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + def send_request(self, request: HttpRequest, *, stream: bool = False, **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) + >>> response = client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -175,7 +161,11 @@ def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore def close(self) -> None: 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 53902fc476d9..2536d71cc4a8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,28 +18,36 @@ from azure.core.credentials import TokenCredential -class ContainerRegistryManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerRegistryManagementClient. +class ContainerRegistryClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ContainerRegistryClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-11-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "TokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2025-11-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -47,7 +55,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-containerregistry/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_patch.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/__init__.py @@ -1,6 +1,6 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/model_base.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/model_base.py new file mode 100644 index 000000000000..d962e0e8fceb --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/model_base.py @@ -0,0 +1,1327 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null +from azure.core.rest import HttpResponse + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") +_NONE_TYPE = type(None) + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + +_ARRAY_ENCODE_MAPPING = { + "pipeDelimited": "|", + "spaceDelimited": " ", + "commaDelimited": ",", + "newlineDelimited": "\n", +} + + +def _deserialize_array_encoded(delimit: str, attr): + if isinstance(attr, str): + if attr == "": + return [] + return attr.split(delimit) + return attr + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj # type: ignore[no-any-return] + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) # type: ignore[no-any-return] + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if annotation is str and rf and rf._format in _ARRAY_ENCODE_MAPPING: + return functools.partial(_deserialize_array_encoded, _ARRAY_ENCODE_MAPPING[rf._format]) + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + # If this key has been deserialized (for mutable types), we need to handle serialization + if hasattr(self, "_attr_to_rest_field"): + cache_attr = f"_deserialized_{key}" + if hasattr(self, cache_attr): + rf = _get_rest_field(getattr(self, "_attr_to_rest_field"), key) + if rf: + value = self._data.get(key) + if isinstance(value, (dict, list, set)): + # For mutable types, serialize and return + # But also update _data with serialized form and clear flag + # so mutations via this returned value affect _data + serialized = _serialize(value, rf._format) + # If serialized form is same type (no transformation needed), + # return _data directly so mutations work + if isinstance(serialized, type(value)) and serialized == value: + return self._data.get(key) + # Otherwise return serialized copy and clear flag + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + # Store serialized form back + self._data[key] = serialized + return serialized + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + # Clear any cached deserialized value when setting through dictionary access + cache_attr = f"_deserialized_{key}" + try: + object.__delattr__(self, cache_attr) + except AttributeError: + pass + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + if format in _ARRAY_ENCODE_MAPPING and all(isinstance(x, str) for x in o): + return _ARRAY_ENCODE_MAPPING[format].join(o) + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field(attr_to_rest_field: dict[str, "_RestField"], rest_name: str) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: list[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + try: + if ( + isinstance(obj, str) + and isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ): + # encoded string may be deserialized to sequence + return deserializer(obj) + except: # pylint: disable=bare-except + pass + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: list[typing.Any]) -> list[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a is _NONE_TYPE for a in annotation.__args__): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a is not _NONE_TYPE), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a is not _NONE_TYPE] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() == "dict": + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + annotation_name = ( + annotation.__name__ if hasattr(annotation, "__name__") else annotation._name # pyright: ignore + ) + if annotation_name.lower() in ["list", "set", "tuple", "sequence"]: + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + response: HttpResponse, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, response.json(), module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + response: HttpResponse, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, response.text()) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + result = getattr(self._type, "args", [None])[0] + # type may be wrapped by nested functools.partial so we need to check for that + if isinstance(result, functools.partial): + return getattr(result, "args", [None])[0] + return result + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + # Use _data.get() directly to avoid triggering __getitem__ which clears the cache + item = obj._data.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + + # For mutable types, we want mutations to directly affect _data + # Check if we've already deserialized this value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + # Return the value from _data directly (it's been deserialized in place) + return obj._data.get(self._rest_name) + + deserialized = _deserialize(self._type, _serialize(item, self._format), rf=self) + + # For mutable types, store the deserialized value back in _data + # so mutations directly affect _data + if isinstance(deserialized, (dict, list, set)): + obj._data[self._rest_name] = deserialized + object.__setattr__(obj, cache_attr, True) # Mark as deserialized + return deserialized + + return deserialized + + def __set__(self, obj: Model, value) -> None: + # Clear the cached deserialized object when setting a new value + cache_attr = f"_deserialized_{self._rest_name}" + if hasattr(obj, cache_attr): + object.__delattr__(obj, cache_attr) + + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[list[str]] = None, + xml: typing.Optional[dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, list[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element # type: ignore[no-any-return] + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: list[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/serialization.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/serialization.py index ff543ed937ff..81ec1de5922b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/serialization.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_utils/serialization.py @@ -3,7 +3,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -821,13 +821,20 @@ def serialize_basic(cls, data, data_type, **kwargs): :param str data_type: Type of object in the iterable. :rtype: str, int, float, bool :return: serialized object + :raises TypeError: raise if data_type is not one of str, int, float, bool. """ custom_serializer = cls._get_custom_serializers(data_type, **kwargs) if custom_serializer: return custom_serializer(data) if data_type == "str": return cls.serialize_unicode(data) - return eval(data_type)(data) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(data) + if data_type == "float": + return float(data) + if data_type == "bool": + return bool(data) + raise TypeError("Unknown basic data type: {}".format(data_type)) @classmethod def serialize_unicode(cls, data): @@ -1757,7 +1764,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return :param str data_type: deserialization data type. :return: Deserialized basic type. :rtype: str, int, float or bool - :raises TypeError: if string format is not valid. + :raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1783,7 +1790,11 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return if data_type == "str": return self.deserialize_unicode(attr) - return eval(data_type)(attr) # nosec # pylint: disable=eval-used + if data_type == "int": + return int(attr) + if data_type == "float": + return float(attr) + raise TypeError("Unknown basic data type: {}".format(data_type)) @staticmethod def deserialize_unicode(data): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_version.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_version.py index f71774b9edf5..256979095a07 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_version.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_version.py @@ -1,12 +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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "14.1.0b4" +VERSION = "15.0.0" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py index 4eb80e51062e..dc63d9d6ff49 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._container_registry_management_client import ContainerRegistryManagementClient # type: ignore +from ._client import ContainerRegistryClient # type: ignore try: from ._patch import __all__ as _patch_all @@ -22,7 +22,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ContainerRegistryManagementClient", + "ContainerRegistryClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore 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/_client.py similarity index 80% rename from sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_container_registry_management_client.py rename to sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_client.py index 9f5bb62587a8..7763060bc2f7 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/_client.py @@ -1,9 +1,8 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,11 +17,9 @@ from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models from .._utils.serialization import Deserializer, Serializer -from ._configuration import ContainerRegistryManagementClientConfiguration +from ._configuration import ContainerRegistryClientConfiguration from .operations import ( - AgentPoolsOperations, CacheRulesOperations, ConnectedRegistriesOperations, CredentialSetsOperations, @@ -30,10 +27,7 @@ PrivateEndpointConnectionsOperations, RegistriesOperations, ReplicationsOperations, - RunsOperations, ScopeMapsOperations, - TaskRunsOperations, - TasksOperations, TokensOperations, WebhooksOperations, ) @@ -43,7 +37,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes +class ContainerRegistryClient: # pylint: disable=too-many-instance-attributes """The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. @@ -54,11 +48,11 @@ class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-v :vartype registries: azure.mgmt.containerregistry.aio.operations.RegistriesOperations :ivar cache_rules: CacheRulesOperations operations :vartype cache_rules: azure.mgmt.containerregistry.aio.operations.CacheRulesOperations + :ivar credential_sets: CredentialSetsOperations operations + :vartype credential_sets: azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations :ivar connected_registries: ConnectedRegistriesOperations operations :vartype connected_registries: azure.mgmt.containerregistry.aio.operations.ConnectedRegistriesOperations - :ivar credential_sets: CredentialSetsOperations operations - :vartype credential_sets: azure.mgmt.containerregistry.aio.operations.CredentialSetsOperations :ivar private_endpoint_connections: PrivateEndpointConnectionsOperations operations :vartype private_endpoint_connections: azure.mgmt.containerregistry.aio.operations.PrivateEndpointConnectionsOperations @@ -70,23 +64,18 @@ class ContainerRegistryManagementClient: # pylint: disable=client-accepts-api-v :vartype tokens: azure.mgmt.containerregistry.aio.operations.TokensOperations :ivar webhooks: WebhooksOperations operations :vartype webhooks: azure.mgmt.containerregistry.aio.operations.WebhooksOperations - :ivar agent_pools: AgentPoolsOperations operations - :vartype agent_pools: azure.mgmt.containerregistry.aio.operations.AgentPoolsOperations - :ivar runs: RunsOperations operations - :vartype runs: azure.mgmt.containerregistry.aio.operations.RunsOperations - :ivar task_runs: TaskRunsOperations operations - :vartype task_runs: azure.mgmt.containerregistry.aio.operations.TaskRunsOperations - :ivar tasks: TasksOperations operations - :vartype tasks: azure.mgmt.containerregistry.aio.operations.TasksOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str :keyword cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :paramtype cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-11-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -100,14 +89,16 @@ def __init__( cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" _cloud = cloud_setting or settings.current.azure_cloud # type: ignore _endpoints = get_arm_endpoints(_cloud) if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ContainerRegistryManagementClientConfiguration( + self._config = ContainerRegistryClientConfiguration( credential=credential, subscription_id=subscription_id, + base_url=cast(str, base_url), cloud_setting=cloud_setting, credential_scopes=credential_scopes, **kwargs @@ -132,20 +123,19 @@ def __init__( self._config.http_logging_policy, ] self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( - base_url=cast(str, base_url), policies=_policies, **kwargs + base_url=cast(str, _endpoint), policies=_policies, **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 = Serializer() + self._deserialize = Deserializer() self._serialize.client_side_validation = False self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) self.registries = RegistriesOperations(self._client, self._config, self._serialize, self._deserialize) self.cache_rules = CacheRulesOperations(self._client, self._config, self._serialize, self._deserialize) + self.credential_sets = CredentialSetsOperations(self._client, self._config, self._serialize, self._deserialize) self.connected_registries = ConnectedRegistriesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.credential_sets = CredentialSetsOperations(self._client, self._config, self._serialize, self._deserialize) self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) @@ -153,12 +143,8 @@ def __init__( 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.agent_pools = AgentPoolsOperations(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( + def send_request( self, request: HttpRequest, *, stream: bool = False, **kwargs: Any ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. @@ -166,7 +152,7 @@ def _send_request( >>> from azure.core.rest import HttpRequest >>> request = HttpRequest("GET", "https://www.example.org/") - >>> response = await client._send_request(request) + >>> response = await client.send_request(request) For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request @@ -179,7 +165,11 @@ def _send_request( """ request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore async def close(self) -> None: 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 f32f7728d166..020dcdc4f93d 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -18,28 +18,36 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerRegistryManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerRegistryManagementClient. +class ContainerRegistryClientConfiguration: # pylint: disable=too-many-instance-attributes + """Configuration for ContainerRegistryClient. 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. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str :param cloud_setting: The cloud setting for which to get the ARM endpoint. Default value is None. :type cloud_setting: ~azure.core.AzureClouds + :keyword api_version: The API version to use for this operation. Default value is "2025-11-01". + Note that overriding this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, + base_url: str = "https://management.azure.com", cloud_setting: Optional["AzureClouds"] = None, **kwargs: Any ) -> None: + api_version: str = kwargs.pop("api_version", "2025-11-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -47,7 +55,9 @@ def __init__( self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.cloud_setting = cloud_setting + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-containerregistry/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_patch.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/__init__.py index 1c6b64d3cdfb..5dad0f409b6a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,19 +13,15 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._registries_operations import RegistriesOperations # type: ignore -from ._cache_rules_operations import CacheRulesOperations # type: ignore -from ._connected_registries_operations import ConnectedRegistriesOperations # type: ignore -from ._credential_sets_operations import CredentialSetsOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._replications_operations import ReplicationsOperations # type: ignore -from ._scope_maps_operations import ScopeMapsOperations # type: ignore -from ._tokens_operations import TokensOperations # type: ignore -from ._webhooks_operations import WebhooksOperations # type: ignore -from ._agent_pools_operations import AgentPoolsOperations # type: ignore -from ._runs_operations import RunsOperations # type: ignore -from ._task_runs_operations import TaskRunsOperations # type: ignore -from ._tasks_operations import TasksOperations # type: ignore +from ._operations import RegistriesOperations # type: ignore +from ._operations import CacheRulesOperations # type: ignore +from ._operations import CredentialSetsOperations # type: ignore +from ._operations import ConnectedRegistriesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import ReplicationsOperations # type: ignore +from ._operations import ScopeMapsOperations # type: ignore +from ._operations import TokensOperations # type: ignore +from ._operations import WebhooksOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -35,17 +31,13 @@ "Operations", "RegistriesOperations", "CacheRulesOperations", - "ConnectedRegistriesOperations", "CredentialSetsOperations", + "ConnectedRegistriesOperations", "PrivateEndpointConnectionsOperations", "ReplicationsOperations", "ScopeMapsOperations", "TokensOperations", "WebhooksOperations", - "AgentPoolsOperations", - "RunsOperations", - "TaskRunsOperations", - "TasksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_agent_pools_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_agent_pools_operations.py deleted file mode 100644 index 7c9f9dded2f1..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_agent_pools_operations.py +++ /dev/null @@ -1,828 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._agent_pools_operations import ( - build_create_request, - build_delete_request, - build_get_queue_status_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class AgentPoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`agent_pools` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.AgentPool"]: - """Lists all the agent pools for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either AgentPool or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.AgentPool - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("AgentPool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool, (IOBase, bytes)): - _content = agent_pool - else: - _json = self._serialize.body(agent_pool, "AgentPool") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: _models.AgentPool, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Creates an agent pool for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Required. - :type agent_pool: ~azure.mgmt.containerregistry.models.AgentPool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Creates an agent pool for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Required. - :type agent_pool: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Creates an agent pool for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Is either a - AgentPool type or a IO[bytes] type. Required. - :type agent_pool: ~azure.mgmt.containerregistry.models.AgentPool or IO[bytes] - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - agent_pool=agent_pool, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: Union[_models.AgentPoolUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_parameters, (IOBase, bytes)): - _content = update_parameters - else: - _json = self._serialize.body(update_parameters, "AgentPoolUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: _models.AgentPoolUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.AgentPoolUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Required. - :type update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: Union[_models.AgentPoolUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Is either a - AgentPoolUpdateParameters type or a IO[bytes] type. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.AgentPoolUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either AgentPool or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - update_parameters=update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, agent_pool_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a specified agent pool resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get_queue_status( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: AgentPoolQueueStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.AgentPoolQueueStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPoolQueueStatus] = kwargs.pop("cls", None) - - _request = build_get_queue_status_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("AgentPoolQueueStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_cache_rules_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_cache_rules_operations.py deleted file mode 100644 index be1b59890bba..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_cache_rules_operations.py +++ /dev/null @@ -1,764 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._cache_rules_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CacheRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`cache_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.CacheRule"]: - """Lists all cache rule resources for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either CacheRule or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CacheRulesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CacheRulesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> _models.CacheRule: - """Gets the properties of the specified cache rule resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :return: CacheRule or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CacheRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("CacheRule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: Union[_models.CacheRule, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache_rule_create_parameters, (IOBase, bytes)): - _content = cache_rule_create_parameters - else: - _json = self._serialize.body(cache_rule_create_parameters, "CacheRule") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: _models.CacheRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. - :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. - :type cache_rule_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: Union[_models.CacheRule, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Is either a - CacheRule type or a IO[bytes] type. Required. - :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - cache_rule_create_parameters=cache_rule_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CacheRule", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CacheRule].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CacheRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache_rule_update_parameters, (IOBase, bytes)): - _content = cache_rule_update_parameters - else: - _json = self._serialize.body(cache_rule_update_parameters, "CacheRuleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: _models.CacheRuleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. - :type cache_rule_update_parameters: - ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. - :type cache_rule_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Is either a - CacheRuleUpdateParameters type or a IO[bytes] type. Required. - :type cache_rule_update_parameters: - ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CacheRule or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - cache_rule_update_parameters=cache_rule_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CacheRule", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CacheRule].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CacheRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a cache rule resource from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_connected_registries_operations.py deleted file mode 100644 index 0ffa989bc9b0..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_connected_registries_operations.py +++ /dev/null @@ -1,906 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._connected_registries_operations import ( - build_create_request, - build_deactivate_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ConnectedRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`connected_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.ConnectedRegistry"]: - """Lists all connected registries for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: An OData filter expression that describes a subset of connectedRegistries to - return. The parameters that can be filtered are parent.id (the resource id of the - connectedRegistry parent), mode, and connectionState. The supported operator is eq. Default - value is None. - :type filter: str - :return: An iterator like instance of either ConnectedRegistry or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ConnectedRegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: ConnectedRegistry or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.ConnectedRegistry - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("ConnectedRegistry", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: Union[_models.ConnectedRegistry, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(connected_registry_create_parameters, (IOBase, bytes)): - _content = connected_registry_create_parameters - else: - _json = self._serialize.body(connected_registry_create_parameters, "ConnectedRegistry") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: _models.ConnectedRegistry, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Creates a connected registry for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Required. - :type connected_registry_create_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistry - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Creates a connected registry for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Required. - :type connected_registry_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: Union[_models.ConnectedRegistry, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Creates a connected registry for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Is either a ConnectedRegistry type or a IO[bytes] type. Required. - :type connected_registry_create_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistry or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - connected_registry_create_parameters=connected_registry_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedRegistry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConnectedRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConnectedRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(connected_registry_update_parameters, (IOBase, bytes)): - _content = connected_registry_update_parameters - else: - _json = self._serialize.body(connected_registry_update_parameters, "ConnectedRegistryUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: _models.ConnectedRegistryUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Required. - :type connected_registry_update_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Required. - :type connected_registry_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Is either a ConnectedRegistryUpdateParameters type or a IO[bytes] type. Required. - :type connected_registry_update_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - connected_registry_update_parameters=connected_registry_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedRegistry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ConnectedRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ConnectedRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a connected registry from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _deactivate_initial( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deactivate_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_deactivate( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deactivates the connected registry instance. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._deactivate_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_credential_sets_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_credential_sets_operations.py deleted file mode 100644 index 9de238204fd9..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_credential_sets_operations.py +++ /dev/null @@ -1,772 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._credential_sets_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class CredentialSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`credential_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.CredentialSet"]: - """Lists all credential set resources for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either CredentialSet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CredentialSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("CredentialSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> _models.CredentialSet: - """Gets the properties of the specified credential set resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :return: CredentialSet or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CredentialSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("CredentialSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: Union[_models.CredentialSet, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(credential_set_create_parameters, (IOBase, bytes)): - _content = credential_set_create_parameters - else: - _json = self._serialize.body(credential_set_create_parameters, "CredentialSet") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: _models.CredentialSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. - Required. - :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. - Required. - :type credential_set_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: Union[_models.CredentialSet, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. Is - either a CredentialSet type or a IO[bytes] type. Required. - :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - credential_set_create_parameters=credential_set_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CredentialSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CredentialSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CredentialSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(credential_set_update_parameters, (IOBase, bytes)): - _content = credential_set_update_parameters - else: - _json = self._serialize.body(credential_set_update_parameters, "CredentialSetUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: _models.CredentialSetUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. - Required. - :type credential_set_update_parameters: - ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. - Required. - :type credential_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. Is - either a CredentialSetUpdateParameters type or a IO[bytes] type. Required. - :type credential_set_update_parameters: - ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - credential_set_update_parameters=credential_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CredentialSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.CredentialSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.CredentialSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a credential set from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py index 905dcbb0dc77..7e187bf5011c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py @@ -1,12 +1,16 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import AsyncPipelineClient from azure.core.async_paging import AsyncItemPaged, AsyncList @@ -16,21 +20,87 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.pipeline import PipelineResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from ..._utils.serialization import Deserializer, Serializer -from ...operations._operations import build_list_request -from .._configuration import ContainerRegistryManagementClientConfiguration +from ...operations._operations import ( + build_cache_rules_create_request, + build_cache_rules_delete_request, + build_cache_rules_get_request, + build_cache_rules_list_request, + build_cache_rules_update_request, + build_connected_registries_create_request, + build_connected_registries_deactivate_request, + build_connected_registries_delete_request, + build_connected_registries_get_request, + build_connected_registries_list_request, + build_connected_registries_update_request, + build_credential_sets_create_request, + build_credential_sets_delete_request, + build_credential_sets_get_request, + build_credential_sets_list_request, + build_credential_sets_update_request, + build_operations_list_request, + build_private_endpoint_connections_create_or_update_request, + build_private_endpoint_connections_delete_request, + build_private_endpoint_connections_get_request, + build_private_endpoint_connections_list_request, + build_registries_check_name_availability_request, + build_registries_create_request, + build_registries_delete_request, + build_registries_generate_credentials_request, + build_registries_get_private_link_resource_request, + build_registries_get_request, + build_registries_import_image_request, + build_registries_list_by_resource_group_request, + build_registries_list_credentials_request, + build_registries_list_private_link_resources_request, + build_registries_list_request, + build_registries_list_usages_request, + build_registries_regenerate_credential_request, + build_registries_update_request, + build_replications_create_request, + build_replications_delete_request, + build_replications_get_request, + build_replications_list_request, + build_replications_update_request, + build_scope_maps_create_request, + build_scope_maps_delete_request, + build_scope_maps_get_request, + build_scope_maps_list_request, + build_scope_maps_update_request, + build_tokens_create_request, + build_tokens_delete_request, + build_tokens_get_request, + build_tokens_list_request, + build_tokens_update_request, + build_webhooks_create_request, + build_webhooks_delete_request, + build_webhooks_get_callback_config_request, + build_webhooks_get_request, + build_webhooks_list_events_request, + build_webhooks_list_request, + build_webhooks_ping_request, + build_webhooks_update_request, +) +from .._configuration import ContainerRegistryClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list @@ -40,18 +110,14 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -59,16 +125,779 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationDefinition"]: """List the operations for the provider. - :return: An iterator like instance of either OperationDefinition or the result of cls(response) + :return: An iterator like instance of OperationDefinition :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.OperationDefinition] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationDefinition]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDefinition], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class RegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`registries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: Registry. The Registry is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Registry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + _request = build_registries_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Registry, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + registry: Union[_models.Registry, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry, (IOBase, bytes)): + _content = registry + else: + _content = json.dumps(registry, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: _models.Registry, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: ~azure.mgmt.containerregistry.models.Registry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: Union[_models.Registry, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Is one of the following + types: Registry, JSON, IO[bytes] Required. + :type registry: ~azure.mgmt.containerregistry.models.Registry or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Registry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Registry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: Union[_models.RegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry_update_parameters, (IOBase, bytes)): + _content = registry_update_parameters + else: + _content = json.dumps(registry_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: _models.RegistryUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: Union[_models.RegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Is one of + the following types: RegistryUpdateParameters, JSON, IO[bytes] Required. + :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Registry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Registry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_registries_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Registry"]: + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Registry + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Registry]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -81,25 +910,48 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationDefinition"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_registries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Registry], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -112,12 +964,7858 @@ async def get_next(next_link=None): 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Registry"]: + """Lists all the container registries under the specified subscription. + + :return: An iterator like instance of Registry + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Registry]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Registry], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _import_image_initial( + self, + resource_group_name: str, + registry_name: str, + parameters: Union[_models.ImportImageParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_import_image_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: _models.ImportImageParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: Union[_models.ImportImageParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Is one of the following types: ImportImageParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: RegistryUsageListResult. The RegistryUsageListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryUsageListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegistryUsageListResult] = kwargs.pop("cls", None) + + _request = build_registries_list_usages_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryUsageListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) + + _request = build_registries_list_credentials_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryListCredentialsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: _models.RegenerateCredentialParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: Union[_models.RegenerateCredentialParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Is one of the following types: + RegenerateCredentialParameters, JSON, IO[bytes] Required. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters or JSON or IO[bytes] + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(regenerate_credential_parameters, (IOBase, bytes)): + _content = regenerate_credential_parameters + else: + _content = json.dumps(regenerate_credential_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_regenerate_credential_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryListCredentialsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _generate_credentials_initial( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(generate_credentials_parameters, (IOBase, bytes)): + _content = generate_credentials_parameters + else: + _content = json.dumps(generate_credentials_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_generate_credentials_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: _models.GenerateCredentialsParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: + """Generate keys for a token of a specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Is one of + the following types: GenerateCredentialsParameters, JSON, IO[bytes] Required. + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateCredentialsResult] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._generate_credentials_initial( + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GenerateCredentialsResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.GenerateCredentialsResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.GenerateCredentialsResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def check_name_availability( + self, + registry_name_check_request: _models.RegistryNameCheckRequest, + *, + content_type: str = "application/json", + **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 request body. Required. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, registry_name_check_request: JSON, *, content_type: str = "application/json", **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 request body. Required. + :type registry_name_check_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def check_name_availability( + self, registry_name_check_request: IO[bytes], *, content_type: str = "application/json", **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 request body. Required. + :type registry_name_check_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def check_name_availability( + self, registry_name_check_request: Union[_models.RegistryNameCheckRequest, JSON, IO[bytes]], **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 request body. Is one of the following types: + RegistryNameCheckRequest, JSON, IO[bytes] Required. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest or JSON or IO[bytes] + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegistryNameStatus] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry_name_check_request, (IOBase, bytes)): + _content = registry_name_check_request + else: + _content = json.dumps(registry_name_check_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryNameStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param group_name: The name of the private link associated with the Azure resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_registries_get_private_link_resource_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_private_link_resources( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registries_list_private_link_resources_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CacheRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`cache_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> _models.CacheRule: + """Gets the properties of the specified cache rule resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :return: CacheRule. The CacheRule is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CacheRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + + _request = build_cache_rules_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CacheRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: Union[_models.CacheRule, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(cache_rule_create_parameters, (IOBase, bytes)): + _content = cache_rule_create_parameters + else: + _content = json.dumps(cache_rule_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cache_rules_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: _models.CacheRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: Union[_models.CacheRule, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Is one of the + following types: CacheRule, JSON, IO[bytes] Required. + :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cache_rule_create_parameters=cache_rule_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CacheRule, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CacheRule].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CacheRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(cache_rule_update_parameters, (IOBase, bytes)): + _content = cache_rule_update_parameters + else: + _content = json.dumps(cache_rule_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cache_rules_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: _models.CacheRuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: + ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Is one of the + following types: CacheRuleUpdateParameters, JSON, IO[bytes] Required. + :type cache_rule_update_parameters: + ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cache_rule_update_parameters=cache_rule_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CacheRule, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CacheRule].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CacheRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cache_rules_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a cache rule resource from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.CacheRule"]: + """Lists all cache rule resources for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of CacheRule + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CacheRule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_cache_rules_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CacheRule], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class CredentialSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`credential_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> _models.CredentialSet: + """Gets the properties of the specified credential set resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :return: CredentialSet. The CredentialSet is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CredentialSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + + _request = build_credential_sets_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CredentialSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: Union[_models.CredentialSet, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(credential_set_create_parameters, (IOBase, bytes)): + _content = credential_set_create_parameters + else: + _content = json.dumps(credential_set_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_sets_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: _models.CredentialSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: Union[_models.CredentialSet, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. Is one + of the following types: CredentialSet, JSON, IO[bytes] Required. + :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + credential_set_create_parameters=credential_set_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CredentialSet, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CredentialSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CredentialSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(credential_set_update_parameters, (IOBase, bytes)): + _content = credential_set_update_parameters + else: + _content = json.dumps(credential_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_sets_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: _models.CredentialSetUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: + ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. Is one + of the following types: CredentialSetUpdateParameters, JSON, IO[bytes] Required. + :type credential_set_update_parameters: + ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns CredentialSet. The CredentialSet is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + credential_set_update_parameters=credential_set_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CredentialSet, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.CredentialSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.CredentialSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_credential_sets_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a credential set from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.CredentialSet"]: + """Lists all credential set resources for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of CredentialSet + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CredentialSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_credential_sets_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CredentialSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ConnectedRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`connected_registries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: ConnectedRegistry. The ConnectedRegistry is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.ConnectedRegistry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + + _request = build_connected_registries_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: Union[_models.ConnectedRegistry, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(connected_registry_create_parameters, (IOBase, bytes)): + _content = connected_registry_create_parameters + else: + _content = json.dumps(connected_registry_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connected_registries_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: _models.ConnectedRegistry, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: Union[_models.ConnectedRegistry, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Creates a connected registry for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Is one of the following types: ConnectedRegistry, JSON, IO[bytes] Required. + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistry or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedRegistry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedRegistry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(connected_registry_update_parameters, (IOBase, bytes)): + _content = connected_registry_update_parameters + else: + _content = json.dumps(connected_registry_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connected_registries_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: _models.ConnectedRegistryUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Is one of the following types: ConnectedRegistryUpdateParameters, JSON, IO[bytes] Required. + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ConnectedRegistry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ConnectedRegistry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_connected_registries_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a connected registry from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.ConnectedRegistry"]: + """Lists all connected registries for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :keyword filter: An OData filter expression that describes a subset of connectedRegistries to + return. The parameters that can be filtered are parent.id (the resource id of the + connectedRegistry parent), mode, and connectionState. The supported operator is eq. Default + value is None. + :paramtype filter: str + :return: An iterator like instance of ConnectedRegistry + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectedRegistry]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connected_registries_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConnectedRegistry], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _deactivate_initial( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_connected_registries_deactivate_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_deactivate( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deactivates the connected registry instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._deactivate_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @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: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ReplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`replications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :return: Replication. The Replication is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Replication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + + _request = build_replications_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Replication, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: Union[_models.Replication, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replication, (IOBase, bytes)): + _content = replication + else: + _content = json.dumps(replication, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replications_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: _models.Replication, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: ~azure.mgmt.containerregistry.models.Replication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: Union[_models.Replication, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Is one of the following types: + Replication, JSON, IO[bytes] Required. + :type replication: ~azure.mgmt.containerregistry.models.Replication or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Replication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Replication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: Union[_models.ReplicationUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replication_update_parameters, (IOBase, bytes)): + _content = replication_update_parameters + else: + _content = json.dumps(replication_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replications_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: _models.ReplicationUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: Union[_models.ReplicationUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Is one of the + following types: ReplicationUpdateParameters, JSON, IO[bytes] Required. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Replication. The Replication is compatible + with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Replication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Replication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, replication_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replications_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Replication"]: + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Replication + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Replication]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_replications_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Replication], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ScopeMapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`scope_maps` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :return: ScopeMap. The ScopeMap is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.ScopeMap + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + + _request = build_scope_maps_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ScopeMap, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: Union[_models.ScopeMap, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(scope_map_create_parameters, (IOBase, bytes)): + _content = scope_map_create_parameters + else: + _content = json.dumps(scope_map_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scope_maps_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: _models.ScopeMap, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: Union[_models.ScopeMap, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Creates a scope map for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Is one of the + following types: ScopeMap, JSON, IO[bytes] Required. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ScopeMap, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ScopeMap].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ScopeMap]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(scope_map_update_parameters, (IOBase, bytes)): + _content = scope_map_update_parameters + else: + _content = json.dumps(scope_map_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scope_maps_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: _models.ScopeMapUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Is one of the + following types: ScopeMapUpdateParameters, JSON, IO[bytes] Required. + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ScopeMap, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.ScopeMap].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ScopeMap]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_scope_maps_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a scope map from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ScopeMap"]: + """Lists all the scope maps for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of ScopeMap + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ScopeMap]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_scope_maps_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ScopeMap], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class TokensOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`tokens` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get(self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :return: Token. The Token is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Token + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + + _request = build_tokens_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Token, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: Union[_models.Token, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(token_create_parameters, (IOBase, bytes)): + _content = token_create_parameters + else: + _content = json.dumps(token_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_tokens_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: _models.Token, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: Union[_models.Token, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Creates a token for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Is one of the following + types: Token, JSON, IO[bytes] Required. + :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_create_parameters=token_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Token, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Token].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Token]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: Union[_models.TokenUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(token_update_parameters, (IOBase, bytes)): + _content = token_update_parameters + else: + _content = json.dumps(token_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_tokens_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: _models.TokenUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: Union[_models.TokenUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Is one of the following + types: TokenUpdateParameters, JSON, IO[bytes] Required. + :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_update_parameters=token_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Token, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Token].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Token]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_tokens_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a token from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Token"]: + """Lists all the tokens for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Token + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Token]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_tokens_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Token], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class WebhooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :attr:`webhooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + _request = build_webhooks_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: Union[_models.WebhookCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(webhook_create_parameters, (IOBase, bytes)): + _content = webhook_create_parameters + else: + _content = json.dumps(webhook_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhooks_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: _models.WebhookCreateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: Union[_models.WebhookCreateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Is one of the + following types: WebhookCreateParameters, JSON, IO[bytes] Required. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._create_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, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Webhook, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Webhook].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Webhook]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(webhook_update_parameters, (IOBase, bytes)): + _content = webhook_update_parameters + else: + _content = json.dumps(webhook_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhooks_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: _models.WebhookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Is one of the + following types: WebhookUpdateParameters, JSON, IO[bytes] Required. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Webhook, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.Webhook].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Webhook]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any + ) -> AsyncIterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_webhooks_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Webhook"]: + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Webhook + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Webhook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_webhooks_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Webhook], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: EventInfo. The EventInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.EventInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EventInfo] = kwargs.pop("cls", None) + + _request = build_webhooks_ping_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EventInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_events( + self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.Event"]: + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: An iterator like instance of Event + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Event] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Event]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_webhooks_list_events_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Event], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: CallbackConfig. The CallbackConfig is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CallbackConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CallbackConfig] = kwargs.pop("cls", None) + + _request = build_webhooks_get_callback_config_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CallbackConfig, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_patch.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index d6b11102a67b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,557 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._private_endpoint_connections_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """List all private endpoint connections in a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Required. - :type private_endpoint_connection: - ~azure.mgmt.containerregistry.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @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: Union[_models.PrivateEndpointConnection, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.containerregistry.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_registries_operations.py deleted file mode 100644 index 41de58ed5939..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_registries_operations.py +++ /dev/null @@ -1,1909 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._registries_operations import ( - build_check_name_availability_request, - build_create_request, - build_delete_request, - build_generate_credentials_request, - build_get_build_source_upload_url_request, - build_get_private_link_resource_request, - build_get_request, - build_import_image_request, - 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_schedule_run_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RegistriesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - async def check_name_availability( - self, - registry_name_check_request: _models.RegistryNameCheckRequest, - *, - content_type: str = "application/json", - **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 request body. Required. - :type registry_name_check_request: - ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def check_name_availability( - self, registry_name_check_request: IO[bytes], *, content_type: str = "application/json", **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 request body. Required. - :type registry_name_check_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def check_name_availability( - self, registry_name_check_request: Union[_models.RegistryNameCheckRequest, IO[bytes]], **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 request body. Is either a RegistryNameCheckRequest type - or a IO[bytes] type. Required. - :type registry_name_check_request: - ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest or IO[bytes] - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegistryNameStatus] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry_name_check_request, (IOBase, bytes)): - _content = registry_name_check_request - else: - _json = self._serialize.body(registry_name_check_request, "RegistryNameCheckRequest") - - _request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("RegistryNameStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Registry"]: - """Lists all the container registries under the specified subscription. - - :return: An iterator like instance of either Registry or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Registry"]: - """Lists all the container registries under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Registry or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: Registry or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Registry - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Registry", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, resource_group_name: str, registry_name: str, registry: Union[_models.Registry, IO[bytes]], **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry, (IOBase, bytes)): - _content = registry - else: - _json = self._serialize.body(registry, "Registry") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - registry: _models.Registry, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Required. - :type registry: ~azure.mgmt.containerregistry.models.Registry - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - registry: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Required. - :type registry: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, resource_group_name: str, registry_name: str, registry: Union[_models.Registry, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Is either a Registry type or - a IO[bytes] type. Required. - :type registry: ~azure.mgmt.containerregistry.models.Registry or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - registry=registry, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Registry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Registry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: Union[_models.RegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry_update_parameters, (IOBase, bytes)): - _content = registry_update_parameters - else: - _json = self._serialize.body(registry_update_parameters, "RegistryUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: _models.RegistryUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Required. - :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Required. - :type registry_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: Union[_models.RegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Is either - a RegistryUpdateParameters type or a IO[bytes] type. Required. - :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Registry or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - registry_update_parameters=registry_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Registry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Registry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _generate_credentials_initial( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(generate_credentials_parameters, (IOBase, bytes)): - _content = generate_credentials_parameters - else: - _json = self._serialize.body(generate_credentials_parameters, "GenerateCredentialsParameters") - - _request = build_generate_credentials_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: _models.GenerateCredentialsParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: - """Generate keys for a token of a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Required. - :type generate_credentials_parameters: - ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: - """Generate keys for a token of a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Required. - :type generate_credentials_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.GenerateCredentialsResult]: - """Generate keys for a token of a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Is either a - GenerateCredentialsParameters type or a IO[bytes] type. Required. - :type generate_credentials_parameters: - ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either GenerateCredentialsResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GenerateCredentialsResult] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._generate_credentials_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - generate_credentials_parameters=generate_credentials_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GenerateCredentialsResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.GenerateCredentialsResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.GenerateCredentialsResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _import_image_initial( - self, - resource_group_name: str, - registry_name: str, - parameters: Union[_models.ImportImageParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ImportImageParameters") - - _request = build_import_image_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: _models.ImportImageParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Required. - :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - async def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace_async - async def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: Union[_models.ImportImageParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Is either a ImportImageParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._import_image_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("RegistryListCredentialsResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: RegistryUsageListResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryUsageListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryUsageListResult] = kwargs.pop("cls", None) - - _request = build_list_usages_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("RegistryUsageListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_private_link_resources( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateLinkResource"]: - """Lists the private link resources for a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.PrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_private_link_resources_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param group_name: The name of the private link associated with the Azure resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_private_link_resource_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: _models.RegenerateCredentialParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Required. - :type regenerate_credential_parameters: - ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Required. - :type regenerate_credential_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: Union[_models.RegenerateCredentialParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Is either a RegenerateCredentialParameters type or a - IO[bytes] type. Required. - :type regenerate_credential_parameters: - ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters or IO[bytes] - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_credential_parameters, (IOBase, bytes)): - _content = regenerate_credential_parameters - else: - _json = self._serialize.body(regenerate_credential_parameters, "RegenerateCredentialParameters") - - _request = build_regenerate_credential_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("RegistryListCredentialsResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_build_source_upload_url( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: SourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.SourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.SourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_build_source_upload_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("SourceUploadDefinition", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: _models.RunRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Required. - :type run_request: ~azure.mgmt.containerregistry.models.RunRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Required. - :type run_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: Union[_models.RunRequest, IO[bytes]], - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Is either a RunRequest type or a IO[bytes] type. - Required. - :type run_request: ~azure.mgmt.containerregistry.models.RunRequest or IO[bytes] - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_request, (IOBase, bytes)): - _content = run_request - else: - _json = self._serialize.body(run_request, "RunRequest") - - _request = build_schedule_run_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_replications_operations.py deleted file mode 100644 index 64ffacfddaaa..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_replications_operations.py +++ /dev/null @@ -1,767 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._replications_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ReplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`replications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Replication"]: - """Lists all the replications for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Replication or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ReplicationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :return: Replication or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Replication - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Replication", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: Union[_models.Replication, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replication, (IOBase, bytes)): - _content = replication - else: - _json = self._serialize.body(replication, "Replication") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: _models.Replication, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Required. - :type replication: ~azure.mgmt.containerregistry.models.Replication - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Required. - :type replication: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: Union[_models.Replication, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Is either a Replication type or - a IO[bytes] type. Required. - :type replication: ~azure.mgmt.containerregistry.models.Replication or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - replication=replication, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Replication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Replication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: Union[_models.ReplicationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replication_update_parameters, (IOBase, bytes)): - _content = replication_update_parameters - else: - _json = self._serialize.body(replication_update_parameters, "ReplicationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: _models.ReplicationUpdateParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Required. - :type replication_update_parameters: - ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Required. - :type replication_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: Union[_models.ReplicationUpdateParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Is either a - ReplicationUpdateParameters type or a IO[bytes] type. Required. - :type replication_update_parameters: - ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - replication_update_parameters=replication_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Replication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Replication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, replication_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_runs_operations.py deleted file mode 100644 index 52ac6856cbee..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_runs_operations.py +++ /dev/null @@ -1,483 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._runs_operations import ( - build_cancel_request, - build_get_log_sas_url_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class RunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> AsyncItemPaged["_models.Run"]: - """Gets all the runs for a registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param filter: The runs filter to apply on the operation. Arithmetic operators are not - supported. The allowed string function is 'contains'. All logical operators except 'Not', - 'Has', 'All' are allowed. Default value is None. - :type filter: str - :param top: $top is supported for get list of runs, which limits the maximum number of runs to - return. Default value is None. - :type top: int - :return: An iterator like instance of either Run or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.RunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: _models.RunUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Required. - :type run_update_parameters: ~azure.mgmt.containerregistry.models.RunUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Required. - :type run_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: Union[_models.RunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Is either a RunUpdateParameters type - or a IO[bytes] type. Required. - :type run_update_parameters: ~azure.mgmt.containerregistry.models.RunUpdateParameters or - IO[bytes] - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_update_parameters, (IOBase, bytes)): - _content = run_update_parameters - else: - _json = self._serialize.body(run_update_parameters, "RunUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def cancel(self, resource_group_name: str, registry_name: str, run_id: str, **kwargs: Any) -> None: - """Cancel an existing run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_cancel_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_log_sas_url( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: RunGetLogResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RunGetLogResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.RunGetLogResult] = kwargs.pop("cls", None) - - _request = build_get_log_sas_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("RunGetLogResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_scope_maps_operations.py deleted file mode 100644 index 4c5bcc22b78f..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_scope_maps_operations.py +++ /dev/null @@ -1,764 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._scope_maps_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class ScopeMapsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`scope_maps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.ScopeMap"]: - """Lists all the scope maps for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either ScopeMap or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ScopeMapListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :return: ScopeMap or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.ScopeMap - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("ScopeMap", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: Union[_models.ScopeMap, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(scope_map_create_parameters, (IOBase, bytes)): - _content = scope_map_create_parameters - else: - _json = self._serialize.body(scope_map_create_parameters, "ScopeMap") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: _models.ScopeMap, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Creates a scope map for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Required. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Creates a scope map for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Required. - :type scope_map_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: Union[_models.ScopeMap, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Creates a scope map for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Is either a - ScopeMap type or a IO[bytes] type. Required. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - scope_map_create_parameters=scope_map_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopeMap", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ScopeMap].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ScopeMap]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(scope_map_update_parameters, (IOBase, bytes)): - _content = scope_map_update_parameters - else: - _json = self._serialize.body(scope_map_update_parameters, "ScopeMapUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: _models.ScopeMapUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Required. - :type scope_map_update_parameters: - ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Required. - :type scope_map_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Is either a - ScopeMapUpdateParameters type or a IO[bytes] type. Required. - :type scope_map_update_parameters: - ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ScopeMap or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - scope_map_update_parameters=scope_map_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopeMap", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.ScopeMap].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ScopeMap]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a scope map from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_task_runs_operations.py deleted file mode 100644 index 42c8bbdc40eb..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_task_runs_operations.py +++ /dev/null @@ -1,766 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._task_runs_operations import ( - build_create_request, - build_delete_request, - build_get_details_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TaskRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`task_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.TaskRun"]: - """Lists all the task runs for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either TaskRun or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: TaskRun or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.TaskRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("TaskRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: Union[_models.TaskRun, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_run, (IOBase, bytes)): - _content = task_run - else: - _json = self._serialize.body(task_run, "TaskRun") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: _models.TaskRun, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Creates a task run for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Required. - :type task_run: ~azure.mgmt.containerregistry.models.TaskRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Creates a task run for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Required. - :type task_run: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: Union[_models.TaskRun, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Creates a task run for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Is either a TaskRun type or a - IO[bytes] type. Required. - :type task_run: ~azure.mgmt.containerregistry.models.TaskRun or IO[bytes] - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - task_run=task_run, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.TaskRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.TaskRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: Union[_models.TaskRunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_parameters, (IOBase, bytes)): - _content = update_parameters - else: - _json = self._serialize.body(update_parameters, "TaskRunUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: _models.TaskRunUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.TaskRunUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Required. - :type update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: Union[_models.TaskRunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Is either a - TaskRunUpdateParameters type or a IO[bytes] type. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.TaskRunUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either TaskRun or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - update_parameters=update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.TaskRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.TaskRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def delete(self, resource_group_name: str, registry_name: str, task_run_name: str, **kwargs: Any) -> None: - """Deletes a specified task run resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_details( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: TaskRun or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.TaskRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - - _request = build_get_details_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("TaskRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tasks_operations.py deleted file mode 100644 index 0e2db1097afd..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tasks_operations.py +++ /dev/null @@ -1,612 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._tasks_operations import ( - build_create_request, - build_delete_request, - build_get_details_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TasksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`tasks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Task"]: - """Lists all the tasks for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either Task or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: _models.Task, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Required. - :type task_create_parameters: ~azure.mgmt.containerregistry.models.Task - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Required. - :type task_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: Union[_models.Task, IO[bytes]], - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Is either a Task type or a - IO[bytes] type. Required. - :type task_create_parameters: ~azure.mgmt.containerregistry.models.Task or IO[bytes] - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_create_parameters, (IOBase, bytes)): - _content = task_create_parameters - else: - _json = self._serialize.body(task_create_parameters, "Task") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: _models.TaskUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Required. - :type task_update_parameters: ~azure.mgmt.containerregistry.models.TaskUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Required. - :type task_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: Union[_models.TaskUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Is either a - TaskUpdateParameters type or a IO[bytes] type. Required. - :type task_update_parameters: ~azure.mgmt.containerregistry.models.TaskUpdateParameters or - IO[bytes] - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_update_parameters, (IOBase, bytes)): - _content = task_update_parameters - else: - _json = self._serialize.body(task_update_parameters, "TaskUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def delete(self, resource_group_name: str, registry_name: str, task_name: str, **kwargs: Any) -> None: - """Deletes a specified task. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace_async - async def get_details( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - _request = build_get_details_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tokens_operations.py deleted file mode 100644 index 2858cb42474a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_tokens_operations.py +++ /dev/null @@ -1,755 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._tokens_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class TokensOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`tokens` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Token"]: - """Lists all the tokens for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Token or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.TokenListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :return: Token or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Token - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Token", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: Union[_models.Token, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(token_create_parameters, (IOBase, bytes)): - _content = token_create_parameters - else: - _json = self._serialize.body(token_create_parameters, "Token") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: _models.Token, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Creates a token for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Required. - :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Creates a token for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Required. - :type token_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: Union[_models.Token, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Creates a token for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Is either a Token type or - a IO[bytes] type. Required. - :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - token_create_parameters=token_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Token", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Token].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Token]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: Union[_models.TokenUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(token_update_parameters, (IOBase, bytes)): - _content = token_update_parameters - else: - _json = self._serialize.body(token_update_parameters, "TokenUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: _models.TokenUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Required. - :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Required. - :type token_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: Union[_models.TokenUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Is either a - TokenUpdateParameters type or a IO[bytes] type. Required. - :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - token_update_parameters=token_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Token", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Token].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Token]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a token from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_webhooks_operations.py deleted file mode 100644 index 0873c5b1fc9a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_webhooks_operations.py +++ /dev/null @@ -1,974 +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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, AsyncIterator, Callable, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ..._utils.serialization import Deserializer, Serializer -from ...operations._webhooks_operations import ( - build_create_request, - build_delete_request, - build_get_callback_config_request, - build_get_request, - build_list_events_request, - build_list_request, - build_ping_request, - build_update_request, -) -from .._configuration import ContainerRegistryManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] -List = list - - -class WebhooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s - :attr:`webhooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> AsyncItemPaged["_models.Webhook"]: - """Lists all the webhooks for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Webhook or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("Webhook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: Union[_models.WebhookCreateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(webhook_create_parameters, (IOBase, bytes)): - _content = webhook_create_parameters - else: - _json = self._serialize.body(webhook_create_parameters, "WebhookCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: _models.WebhookCreateParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Required. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Required. - :type webhook_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: Union[_models.WebhookCreateParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Is either a - WebhookCreateParameters type or a IO[bytes] type. Required. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - webhook_create_parameters=webhook_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Webhook", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Webhook].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Webhook]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(webhook_update_parameters, (IOBase, bytes)): - _content = webhook_update_parameters - else: - _json = self._serialize.body(webhook_update_parameters, "WebhookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: _models.WebhookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Required. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Required. - :type webhook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Is either a - WebhookUpdateParameters type or a IO[bytes] type. Required. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Webhook or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - webhook_update_parameters=webhook_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Webhook", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Webhook].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Webhook]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: CallbackConfig or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CallbackConfig - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CallbackConfig] = kwargs.pop("cls", None) - - _request = build_get_callback_config_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("CallbackConfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_events( - self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.Event"]: - """Lists recent events for the specified webhook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerregistry.models.Event] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.EventListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_events_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: EventInfo or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.EventInfo - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.EventInfo] = kwargs.pop("cls", None) - - _request = build_ping_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [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("EventInfo", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/__init__.py index 117d6ef07214..39366f513795 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,41 +13,25 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore ActivationProperties, Actor, - AgentPool, - AgentPoolListResult, - AgentPoolQueueStatus, - AgentPoolUpdateParameters, - AgentProperties, - Argument, AuthCredential, - AuthInfo, - AuthInfoUpdateParameters, AzureADAuthenticationAsArmPolicy, - BaseImageDependency, - BaseImageTrigger, - BaseImageTriggerUpdateParameters, CacheRule, + CacheRuleProperties, CacheRuleUpdateParameters, - CacheRulesListResult, + CacheRuleUpdateProperties, CallbackConfig, ConnectedRegistry, - ConnectedRegistryListResult, + ConnectedRegistryProperties, ConnectedRegistryUpdateParameters, + ConnectedRegistryUpdateProperties, CredentialHealth, CredentialSet, - CredentialSetListResult, + CredentialSetProperties, CredentialSetUpdateParameters, - Credentials, - CustomRegistryCredentials, - DockerBuildRequest, - DockerBuildStep, - DockerBuildStepUpdateParameters, - EncodedTaskRunRequest, - EncodedTaskStep, - EncodedTaskStepUpdateParameters, + CredentialSetUpdateProperties, EncryptionProperty, ErrorAdditionalInfo, ErrorDetail, @@ -55,20 +39,14 @@ Event, EventContent, EventInfo, - EventListResult, EventRequestMessage, EventResponseMessage, ExportPolicy, - FileTaskRunRequest, - FileTaskStep, - FileTaskStepUpdateParameters, GarbageCollectionProperties, GenerateCredentialsParameters, GenerateCredentialsResult, IPRule, IdentityProperties, - ImageDescriptor, - ImageUpdateTrigger, ImportImageParameters, ImportSource, ImportSourceCredentials, @@ -78,109 +56,81 @@ NetworkRuleSet, OperationDefinition, OperationDisplayDefinition, - OperationListResult, OperationLogSpecificationDefinition, OperationMetricSpecificationDefinition, + OperationPropertiesDefinition, OperationServiceSpecificationDefinition, - OverrideTaskStepProperties, ParentProperties, - PlatformProperties, - PlatformUpdateParameters, Policies, PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, + PrivateEndpointConnectionProperties, PrivateLinkResource, - PrivateLinkResourceListResult, + PrivateLinkResourceProperties, PrivateLinkServiceConnectionState, ProxyResource, QuarantinePolicy, RegenerateCredentialParameters, Registry, RegistryListCredentialsResult, - RegistryListResult, RegistryNameCheckRequest, RegistryNameStatus, RegistryPassword, + RegistryProperties, + RegistryPropertiesUpdateParameters, RegistryUpdateParameters, RegistryUsage, RegistryUsageListResult, Replication, - ReplicationListResult, + ReplicationProperties, ReplicationUpdateParameters, + ReplicationUpdateParametersProperties, Request, Resource, RetentionPolicy, - Run, - RunGetLogResult, - RunListResult, - RunRequest, - RunUpdateParameters, ScopeMap, - ScopeMapListResult, + ScopeMapProperties, + ScopeMapPropertiesUpdateParameters, ScopeMapUpdateParameters, - SecretObject, - SetValue, Sku, Source, - SourceProperties, - SourceRegistryCredentials, - SourceTrigger, - SourceTriggerDescriptor, - SourceTriggerUpdateParameters, - SourceUpdateParameters, - SourceUploadDefinition, Status, StatusDetailProperties, SyncProperties, SyncUpdateProperties, SystemData, Target, - Task, - TaskListResult, - TaskRun, - TaskRunListResult, - TaskRunRequest, - TaskRunUpdateParameters, - TaskStepProperties, - TaskStepUpdateParameters, - TaskUpdateParameters, - TimerTrigger, - TimerTriggerDescriptor, - TimerTriggerUpdateParameters, TlsCertificateProperties, TlsProperties, Token, TokenCertificate, TokenCredentialsProperties, - TokenListResult, TokenPassword, + TokenProperties, TokenUpdateParameters, + TokenUpdateProperties, TrackedResource, - TriggerProperties, - TriggerUpdateParameters, TrustPolicy, UserIdentityProperties, Webhook, WebhookCreateParameters, - WebhookListResult, + WebhookProperties, + WebhookPropertiesCreateParameters, + WebhookPropertiesUpdateParameters, WebhookUpdateParameters, ) -from ._container_registry_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore Action, ActionsRequired, ActivationStatus, - Architecture, AuditLogStatus, - AutoGeneratedDomainNameLabelScope, AzureADAuthenticationAsArmPolicyStatus, - BaseImageDependencyType, - BaseImageTriggerType, CertificateType, ConnectedRegistryMode, ConnectionState, ConnectionStatus, + ContainerRegistryResourceType, CreatedByType, CredentialHealthStatus, CredentialName, @@ -190,7 +140,6 @@ ImportMode, LogLevel, NetworkRuleBypassOptions, - OS, PasswordName, PolicyStatus, ProvisioningState, @@ -198,25 +147,13 @@ RegistryUsageUnit, ResourceIdentityType, RoleAssignmentMode, - RunStatus, - RunType, - SecretObjectType, SkuName, SkuTier, - SourceControlType, - SourceRegistryLoginMode, - SourceTriggerEvent, - StepType, - TaskStatus, TlsStatus, TokenCertificateName, TokenPasswordName, TokenStatus, - TokenType, - TriggerStatus, TrustPolicyType, - UpdateTriggerPayloadType, - Variant, WebhookAction, WebhookStatus, ZoneRedundancy, @@ -228,38 +165,22 @@ __all__ = [ "ActivationProperties", "Actor", - "AgentPool", - "AgentPoolListResult", - "AgentPoolQueueStatus", - "AgentPoolUpdateParameters", - "AgentProperties", - "Argument", "AuthCredential", - "AuthInfo", - "AuthInfoUpdateParameters", "AzureADAuthenticationAsArmPolicy", - "BaseImageDependency", - "BaseImageTrigger", - "BaseImageTriggerUpdateParameters", "CacheRule", + "CacheRuleProperties", "CacheRuleUpdateParameters", - "CacheRulesListResult", + "CacheRuleUpdateProperties", "CallbackConfig", "ConnectedRegistry", - "ConnectedRegistryListResult", + "ConnectedRegistryProperties", "ConnectedRegistryUpdateParameters", + "ConnectedRegistryUpdateProperties", "CredentialHealth", "CredentialSet", - "CredentialSetListResult", + "CredentialSetProperties", "CredentialSetUpdateParameters", - "Credentials", - "CustomRegistryCredentials", - "DockerBuildRequest", - "DockerBuildStep", - "DockerBuildStepUpdateParameters", - "EncodedTaskRunRequest", - "EncodedTaskStep", - "EncodedTaskStepUpdateParameters", + "CredentialSetUpdateProperties", "EncryptionProperty", "ErrorAdditionalInfo", "ErrorDetail", @@ -267,20 +188,14 @@ "Event", "EventContent", "EventInfo", - "EventListResult", "EventRequestMessage", "EventResponseMessage", "ExportPolicy", - "FileTaskRunRequest", - "FileTaskStep", - "FileTaskStepUpdateParameters", "GarbageCollectionProperties", "GenerateCredentialsParameters", "GenerateCredentialsResult", "IPRule", "IdentityProperties", - "ImageDescriptor", - "ImageUpdateTrigger", "ImportImageParameters", "ImportSource", "ImportSourceCredentials", @@ -290,106 +205,78 @@ "NetworkRuleSet", "OperationDefinition", "OperationDisplayDefinition", - "OperationListResult", "OperationLogSpecificationDefinition", "OperationMetricSpecificationDefinition", + "OperationPropertiesDefinition", "OperationServiceSpecificationDefinition", - "OverrideTaskStepProperties", "ParentProperties", - "PlatformProperties", - "PlatformUpdateParameters", "Policies", "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", + "PrivateEndpointConnectionProperties", "PrivateLinkResource", - "PrivateLinkResourceListResult", + "PrivateLinkResourceProperties", "PrivateLinkServiceConnectionState", "ProxyResource", "QuarantinePolicy", "RegenerateCredentialParameters", "Registry", "RegistryListCredentialsResult", - "RegistryListResult", "RegistryNameCheckRequest", "RegistryNameStatus", "RegistryPassword", + "RegistryProperties", + "RegistryPropertiesUpdateParameters", "RegistryUpdateParameters", "RegistryUsage", "RegistryUsageListResult", "Replication", - "ReplicationListResult", + "ReplicationProperties", "ReplicationUpdateParameters", + "ReplicationUpdateParametersProperties", "Request", "Resource", "RetentionPolicy", - "Run", - "RunGetLogResult", - "RunListResult", - "RunRequest", - "RunUpdateParameters", "ScopeMap", - "ScopeMapListResult", + "ScopeMapProperties", + "ScopeMapPropertiesUpdateParameters", "ScopeMapUpdateParameters", - "SecretObject", - "SetValue", "Sku", "Source", - "SourceProperties", - "SourceRegistryCredentials", - "SourceTrigger", - "SourceTriggerDescriptor", - "SourceTriggerUpdateParameters", - "SourceUpdateParameters", - "SourceUploadDefinition", "Status", "StatusDetailProperties", "SyncProperties", "SyncUpdateProperties", "SystemData", "Target", - "Task", - "TaskListResult", - "TaskRun", - "TaskRunListResult", - "TaskRunRequest", - "TaskRunUpdateParameters", - "TaskStepProperties", - "TaskStepUpdateParameters", - "TaskUpdateParameters", - "TimerTrigger", - "TimerTriggerDescriptor", - "TimerTriggerUpdateParameters", "TlsCertificateProperties", "TlsProperties", "Token", "TokenCertificate", "TokenCredentialsProperties", - "TokenListResult", "TokenPassword", + "TokenProperties", "TokenUpdateParameters", + "TokenUpdateProperties", "TrackedResource", - "TriggerProperties", - "TriggerUpdateParameters", "TrustPolicy", "UserIdentityProperties", "Webhook", "WebhookCreateParameters", - "WebhookListResult", + "WebhookProperties", + "WebhookPropertiesCreateParameters", + "WebhookPropertiesUpdateParameters", "WebhookUpdateParameters", "Action", "ActionsRequired", "ActivationStatus", - "Architecture", "AuditLogStatus", - "AutoGeneratedDomainNameLabelScope", "AzureADAuthenticationAsArmPolicyStatus", - "BaseImageDependencyType", - "BaseImageTriggerType", "CertificateType", "ConnectedRegistryMode", "ConnectionState", "ConnectionStatus", + "ContainerRegistryResourceType", "CreatedByType", "CredentialHealthStatus", "CredentialName", @@ -399,7 +286,6 @@ "ImportMode", "LogLevel", "NetworkRuleBypassOptions", - "OS", "PasswordName", "PolicyStatus", "ProvisioningState", @@ -407,25 +293,13 @@ "RegistryUsageUnit", "ResourceIdentityType", "RoleAssignmentMode", - "RunStatus", - "RunType", - "SecretObjectType", "SkuName", "SkuTier", - "SourceControlType", - "SourceRegistryLoginMode", - "SourceTriggerEvent", - "StepType", - "TaskStatus", "TlsStatus", "TokenCertificateName", "TokenPasswordName", "TokenStatus", - "TokenType", - "TriggerStatus", "TrustPolicyType", - "UpdateTriggerPayloadType", - "Variant", "WebhookAction", "WebhookStatus", "ZoneRedundancy", diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_container_registry_management_client_enums.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_enums.py similarity index 66% rename from sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_container_registry_management_client_enums.py rename to sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_enums.py index dc612513ddc0..c746b218da31 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_container_registry_management_client_enums.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_enums.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -30,16 +30,6 @@ class ActivationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): INACTIVE = "Inactive" -class Architecture(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The OS architecture.""" - - AMD64 = "amd64" - X86 = "x86" - THREE_HUNDRED_EIGHTY_SIX = "386" - ARM = "arm" - ARM64 = "arm64" - - class AuditLogStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether audit logs are enabled on the connected registry.""" @@ -47,18 +37,6 @@ class AuditLogStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "Disabled" -class AutoGeneratedDomainNameLabelScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The auto generated domain name label of the container registry. This value defaults to - "Unsecure". - """ - - UNSECURE = "Unsecure" - TENANT_REUSE = "TenantReuse" - SUBSCRIPTION_REUSE = "SubscriptionReuse" - RESOURCE_GROUP_REUSE = "ResourceGroupReuse" - NO_REUSE = "NoReuse" - - class AzureADAuthenticationAsArmPolicyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The value that indicates whether the policy is enabled or not.""" @@ -66,20 +44,6 @@ class AzureADAuthenticationAsArmPolicyStatus(str, Enum, metaclass=CaseInsensitiv DISABLED = "disabled" -class BaseImageDependencyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the base image dependency.""" - - BUILD_TIME = "BuildTime" - RUN_TIME = "RunTime" - - -class BaseImageTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the auto trigger for base image dependency updates.""" - - ALL = "All" - RUNTIME = "Runtime" - - class CertificateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of certificate location.""" @@ -113,13 +77,23 @@ class ConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISCONNECTED = "Disconnected" +class ContainerRegistryResourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The resource type for Container Registry.""" + + MICROSOFT_CONTAINER_REGISTRY_REGISTRIES = "Microsoft.ContainerRegistry/registries" + + class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" + """The kind of entity that created the resource.""" USER = "User" + """The entity was created by a user.""" APPLICATION = "Application" + """The entity was created by an application.""" MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" KEY = "Key" + """The entity was created by a key.""" class CredentialHealthStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -182,13 +156,6 @@ class NetworkRuleBypassOptions(str, Enum, metaclass=CaseInsensitiveEnumMeta): NONE = "None" -class OS(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The OS of agent machine.""" - - WINDOWS = "Windows" - LINUX = "Linux" - - class PasswordName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The password name.""" @@ -204,7 +171,7 @@ class PolicyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of this agent pool.""" + """The provisioning state of the archive at the time the operation was called.""" CREATING = "Creating" UPDATING = "Updating" @@ -244,37 +211,6 @@ class RoleAssignmentMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): LEGACY_REGISTRY_PERMISSIONS = "LegacyRegistryPermissions" -class RunStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of the run.""" - - QUEUED = "Queued" - STARTED = "Started" - RUNNING = "Running" - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - ERROR = "Error" - TIMEOUT = "Timeout" - - -class RunType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of run.""" - - QUICK_BUILD = "QuickBuild" - QUICK_RUN = "QuickRun" - AUTO_BUILD = "AutoBuild" - AUTO_RUN = "AutoRun" - - -class SecretObjectType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the secret object which determines how the value of the secret object has to be - interpreted. - """ - - OPAQUE = "Opaque" - VAULTSECRET = "Vaultsecret" - - class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The SKU name of the container registry. Required for registry creation.""" @@ -293,46 +229,6 @@ class SkuTier(str, Enum, metaclass=CaseInsensitiveEnumMeta): PREMIUM = "Premium" -class SourceControlType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of source control service.""" - - GITHUB = "Github" - VISUAL_STUDIO_TEAM_SERVICE = "VisualStudioTeamService" - - -class SourceRegistryLoginMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """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. - """ - - NONE = "None" - DEFAULT = "Default" - - -class SourceTriggerEvent(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """SourceTriggerEvent.""" - - COMMIT = "commit" - PULLREQUEST = "pullrequest" - - -class StepType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of the step.""" - - DOCKER = "Docker" - FILE_TASK = "FileTask" - ENCODED_TASK = "EncodedTask" - - -class TaskStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of task.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - class TlsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates whether HTTPS is enabled for the login server.""" @@ -341,7 +237,7 @@ class TlsStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): class TokenCertificateName(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """TokenCertificateName.""" + """Type of TokenCertificateName.""" CERTIFICATE1 = "certificate1" CERTIFICATE2 = "certificate2" @@ -361,43 +257,14 @@ class TokenStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): DISABLED = "disabled" -class TokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of Auth token.""" - - PAT = "PAT" - O_AUTH = "OAuth" - - -class TriggerStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The current status of trigger.""" - - DISABLED = "Disabled" - ENABLED = "Enabled" - - class TrustPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of trust policy.""" NOTARY = "Notary" -class UpdateTriggerPayloadType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of Payload body for Base image update triggers.""" - - DEFAULT = "Default" - TOKEN = "Token" - - -class Variant(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Variant of the CPU.""" - - V6 = "v6" - V7 = "v7" - V8 = "v8" - - class WebhookAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """WebhookAction.""" + """Type of WebhookAction.""" PUSH = "push" DELETE = "delete" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py new file mode 100644 index 000000000000..3028f1fa03d6 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py @@ -0,0 +1,4712 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class ActivationProperties(_Model): + """The activation properties of the connected registry. + + :ivar status: The activation status of the connected registry. Known values are: "Active" and + "Inactive". + :vartype status: str or ~azure.mgmt.containerregistry.models.ActivationStatus + """ + + status: Optional[Union[str, "_models.ActivationStatus"]] = rest_field(visibility=["read"]) + """The activation status of the connected registry. Known values are: \"Active\" and \"Inactive\".""" + + +class Actor(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The subject or username associated with the request context that generated the event.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AuthCredential(_Model): + """Authentication credential stored for an upstream. + + :ivar name: The name of the credential. "Credential1" + :vartype name: str or ~azure.mgmt.containerregistry.models.CredentialName + :ivar username_secret_identifier: KeyVault Secret URI for accessing the username. + :vartype username_secret_identifier: str + :ivar password_secret_identifier: KeyVault Secret URI for accessing the password. + :vartype password_secret_identifier: str + :ivar credential_health: This provides data pertaining to the health of the auth credential. + :vartype credential_health: ~azure.mgmt.containerregistry.models.CredentialHealth + """ + + name: Optional[Union[str, "_models.CredentialName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the credential. \"Credential1\"""" + username_secret_identifier: Optional[str] = rest_field( + name="usernameSecretIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """KeyVault Secret URI for accessing the username.""" + password_secret_identifier: Optional[str] = rest_field( + name="passwordSecretIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """KeyVault Secret URI for accessing the password.""" + credential_health: Optional["_models.CredentialHealth"] = rest_field(name="credentialHealth", visibility=["read"]) + """This provides data pertaining to the health of the auth credential.""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.CredentialName"]] = None, + username_secret_identifier: Optional[str] = None, + password_secret_identifier: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureADAuthenticationAsArmPolicy(_Model): + """The policy for using Azure Resource Manager audience token for a container registry. + + :ivar status: The value that indicates whether the policy is enabled or not. Known values are: + "enabled" and "disabled". + :vartype status: str or + ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicyStatus + """ + + status: Optional[Union[str, "_models.AzureADAuthenticationAsArmPolicyStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the policy is enabled or not. Known values are: \"enabled\" + and \"disabled\".""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.AzureADAuthenticationAsArmPolicyStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the private link resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class ProxyResource(Resource): + """Proxy Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + """ + + +class CacheRule(ProxyResource): + """An object that represents a cache rule for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of the cache rule. + :vartype properties: ~azure.mgmt.containerregistry.models.CacheRuleProperties + """ + + properties: Optional["_models.CacheRuleProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the cache rule.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CacheRuleProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CacheRuleProperties(_Model): + """The properties of a cache rule. + + :ivar credential_set_resource_id: The ARM resource ID of the credential store which is + associated with the cache rule. + :vartype credential_set_resource_id: str + :ivar source_repository: Source repository pulled from upstream. + :vartype source_repository: str + :ivar target_repository: Target repository specified in docker pull command. + Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag}. + :vartype target_repository: str + :ivar creation_date: The creation date of the cache rule. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + """ + + credential_set_resource_id: Optional[str] = rest_field( + name="credentialSetResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM resource ID of the credential store which is associated with the cache rule.""" + source_repository: Optional[str] = rest_field( + name="sourceRepository", visibility=["read", "create", "update", "delete", "query"] + ) + """Source repository pulled from upstream.""" + target_repository: Optional[str] = rest_field( + name="targetRepository", visibility=["read", "create", "update", "delete", "query"] + ) + """Target repository specified in docker pull command. + Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag}.""" + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of the cache rule.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + credential_set_resource_id: Optional[str] = None, + source_repository: Optional[str] = None, + target_repository: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CacheRuleUpdateParameters(_Model): + """The parameters for updating a cache rule. + + :ivar properties: The properties of the cache rule update parameters. + :vartype properties: ~azure.mgmt.containerregistry.models.CacheRuleUpdateProperties + """ + + properties: Optional["_models.CacheRuleUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the cache rule update parameters.""" + + __flattened_items = ["credential_set_resource_id"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CacheRuleUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CacheRuleUpdateProperties(_Model): + """The parameters for updating cache rule properties. + + :ivar credential_set_resource_id: The ARM resource ID of the credential store which is + associated with the Cache rule. + :vartype credential_set_resource_id: str + """ + + credential_set_resource_id: Optional[str] = rest_field( + name="credentialSetResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The ARM resource ID of the credential store which is associated with the Cache rule.""" + + @overload + def __init__( + self, + *, + credential_set_resource_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CallbackConfig(_Model): + """The configuration of service URI and custom headers for the webhook. + + :ivar service_uri: The service URI for the webhook to post notifications. Required. + :vartype service_uri: str + :ivar custom_headers: Custom headers that will be added to the webhook notifications. + :vartype custom_headers: dict[str, str] + """ + + service_uri: str = rest_field(name="serviceUri", visibility=["read", "create", "update", "delete", "query"]) + """The service URI for the webhook to post notifications. Required.""" + custom_headers: Optional[dict[str, str]] = rest_field( + name="customHeaders", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom headers that will be added to the webhook notifications.""" + + @overload + def __init__( + self, + *, + service_uri: str, + custom_headers: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectedRegistry(ProxyResource): + """An object that represents a connected registry for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of the connected registry. + :vartype properties: ~azure.mgmt.containerregistry.models.ConnectedRegistryProperties + """ + + properties: Optional["_models.ConnectedRegistryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the connected registry.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConnectedRegistryProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectedRegistryProperties(_Model): + """The properties of a connected registry. + + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + :ivar mode: The mode of the connected registry resource that indicates the permissions of the + registry. Required. Known values are: "ReadWrite", "ReadOnly", "Registry", and "Mirror". + :vartype mode: str or ~azure.mgmt.containerregistry.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. Known values + are: "Online", "Offline", "Syncing", and "Unhealthy". + :vartype connection_state: str or ~azure.mgmt.containerregistry.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.models.ActivationProperties + :ivar parent: The parent of the connected registry. Required. + :vartype parent: ~azure.mgmt.containerregistry.models.ParentProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :vartype client_token_ids: list[str] + :ivar login_server: The login server properties of the connected registry. + :vartype login_server: ~azure.mgmt.containerregistry.models.LoginServerProperties + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.models.LoggingProperties + :ivar status_details: The list of current statuses of the connected registry. + :vartype status_details: list[~azure.mgmt.containerregistry.models.StatusDetailProperties] + :ivar notifications_list: The list of notifications subscription information for the connected + registry. + :vartype notifications_list: list[str] + :ivar garbage_collection: The garbage collection properties of the connected registry. + :vartype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + mode: Union[str, "_models.ConnectedRegistryMode"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The mode of the connected registry resource that indicates the permissions of the registry. + Required. Known values are: \"ReadWrite\", \"ReadOnly\", \"Registry\", and \"Mirror\".""" + version: Optional[str] = rest_field(visibility=["read"]) + """The current version of ACR runtime on the connected registry.""" + connection_state: Optional[Union[str, "_models.ConnectionState"]] = rest_field( + name="connectionState", visibility=["read"] + ) + """The current connection state of the connected registry. Known values are: \"Online\", + \"Offline\", \"Syncing\", and \"Unhealthy\".""" + last_activity_time: Optional[datetime.datetime] = rest_field( + name="lastActivityTime", visibility=["read"], format="rfc3339" + ) + """The last activity time of the connected registry.""" + activation: Optional["_models.ActivationProperties"] = rest_field(visibility=["read"]) + """The activation properties of the connected registry.""" + parent: "_models.ParentProperties" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parent of the connected registry. Required.""" + client_token_ids: Optional[list[str]] = rest_field( + name="clientTokenIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the ACR token resource IDs used to authenticate clients to the connected registry.""" + login_server: Optional["_models.LoginServerProperties"] = rest_field( + name="loginServer", visibility=["read", "create", "update", "delete", "query"] + ) + """The login server properties of the connected registry.""" + logging: Optional["_models.LoggingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The logging properties of the connected registry.""" + status_details: Optional[list["_models.StatusDetailProperties"]] = rest_field( + name="statusDetails", visibility=["read"] + ) + """The list of current statuses of the connected registry.""" + notifications_list: Optional[list[str]] = rest_field( + name="notificationsList", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of notifications subscription information for the connected registry.""" + garbage_collection: Optional["_models.GarbageCollectionProperties"] = rest_field( + name="garbageCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """The garbage collection properties of the connected registry.""" + + @overload + def __init__( + self, + *, + mode: Union[str, "_models.ConnectedRegistryMode"], + parent: "_models.ParentProperties", + client_token_ids: Optional[list[str]] = None, + login_server: Optional["_models.LoginServerProperties"] = None, + logging: Optional["_models.LoggingProperties"] = None, + notifications_list: Optional[list[str]] = None, + garbage_collection: Optional["_models.GarbageCollectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConnectedRegistryUpdateParameters(_Model): + """The parameters for updating a connected registry. + + :ivar properties: The properties of the connected registry update parameters. + :vartype properties: ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateProperties + """ + + properties: Optional["_models.ConnectedRegistryUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the connected registry update parameters.""" + + __flattened_items = ["sync_properties", "logging", "client_token_ids", "notifications_list", "garbage_collection"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ConnectedRegistryUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ConnectedRegistryUpdateProperties(_Model): + """The parameters for updating token properties. + + :ivar sync_properties: The sync properties of the connected registry with its parent. + :vartype sync_properties: ~azure.mgmt.containerregistry.models.SyncUpdateProperties + :ivar logging: The logging properties of the connected registry. + :vartype logging: ~azure.mgmt.containerregistry.models.LoggingProperties + :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to + the connected registry. + :vartype client_token_ids: list[str] + :ivar notifications_list: The list of notifications subscription information for the connected + registry. + :vartype notifications_list: list[str] + :ivar garbage_collection: The garbage collection properties of the connected registry. + :vartype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties + """ + + sync_properties: Optional["_models.SyncUpdateProperties"] = rest_field( + name="syncProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync properties of the connected registry with its parent.""" + logging: Optional["_models.LoggingProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The logging properties of the connected registry.""" + client_token_ids: Optional[list[str]] = rest_field( + name="clientTokenIds", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of the ACR token resource IDs used to authenticate clients to the connected registry.""" + notifications_list: Optional[list[str]] = rest_field( + name="notificationsList", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of notifications subscription information for the connected registry.""" + garbage_collection: Optional["_models.GarbageCollectionProperties"] = rest_field( + name="garbageCollection", visibility=["read", "create", "update", "delete", "query"] + ) + """The garbage collection properties of the connected registry.""" + + @overload + def __init__( + self, + *, + sync_properties: Optional["_models.SyncUpdateProperties"] = None, + logging: Optional["_models.LoggingProperties"] = None, + client_token_ids: Optional[list[str]] = None, + notifications_list: Optional[list[str]] = None, + garbage_collection: Optional["_models.GarbageCollectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialHealth(_Model): + """The health of the auth credential. + + :ivar status: The health status of credential. Known values are: "Healthy" and "Unhealthy". + :vartype status: str or ~azure.mgmt.containerregistry.models.CredentialHealthStatus + :ivar error_code: Error code representing the health check error. + :vartype error_code: str + :ivar error_message: Descriptive message representing the health check error. + :vartype error_message: str + """ + + status: Optional[Union[str, "_models.CredentialHealthStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The health status of credential. Known values are: \"Healthy\" and \"Unhealthy\".""" + error_code: Optional[str] = rest_field(name="errorCode", visibility=["read", "create", "update", "delete", "query"]) + """Error code representing the health check error.""" + error_message: Optional[str] = rest_field( + name="errorMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Descriptive message representing the health check error.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.CredentialHealthStatus"]] = None, + error_code: Optional[str] = None, + error_message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialSet(ProxyResource): + """An object that represents a credential set resource for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of the credential set. + :vartype properties: ~azure.mgmt.containerregistry.models.CredentialSetProperties + :ivar identity: Identities associated with the resource. This is used to access the KeyVault + secrets. + :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties + """ + + properties: Optional["_models.CredentialSetProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the credential set.""" + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identities associated with the resource. This is used to access the KeyVault secrets.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.CredentialSetProperties"] = None, + identity: Optional["_models.IdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialSetProperties(_Model): + """The properties of a credential set resource. + + :ivar login_server: The credentials are stored for this upstream or login server. + :vartype login_server: str + :ivar auth_credentials: List of authentication credentials stored for an upstream. + Usually consists of a primary and an optional secondary credential. + :vartype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] + :ivar creation_date: The creation date of credential store resource. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + """ + + login_server: Optional[str] = rest_field( + name="loginServer", visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials are stored for this upstream or login server.""" + auth_credentials: Optional[list["_models.AuthCredential"]] = rest_field( + name="authCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """List of authentication credentials stored for an upstream. + Usually consists of a primary and an optional secondary credential.""" + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of credential store resource.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + login_server: Optional[str] = None, + auth_credentials: Optional[list["_models.AuthCredential"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CredentialSetUpdateParameters(_Model): + """The parameters for updating a credential set. + + :ivar properties: The properties of the credential set update parameters. + :vartype properties: ~azure.mgmt.containerregistry.models.CredentialSetUpdateProperties + :ivar identity: Identities associated with the resource. This is used to access the KeyVault + secrets. + :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties + """ + + properties: Optional["_models.CredentialSetUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the credential set update parameters.""" + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Identities associated with the resource. This is used to access the KeyVault secrets.""" + + __flattened_items = ["auth_credentials"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.CredentialSetUpdateProperties"] = None, + identity: Optional["_models.IdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class CredentialSetUpdateProperties(_Model): + """The parameters for updating credential set properties. + + :ivar auth_credentials: List of authentication credentials stored for an upstream. + Usually consists of a primary and an optional secondary credential. + :vartype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] + """ + + auth_credentials: Optional[list["_models.AuthCredential"]] = rest_field( + name="authCredentials", visibility=["read", "create", "update", "delete", "query"] + ) + """List of authentication credentials stored for an upstream. + Usually consists of a primary and an optional secondary credential.""" + + @overload + def __init__( + self, + *, + auth_credentials: Optional[list["_models.AuthCredential"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EncryptionProperty(_Model): + """EncryptionProperty. + + :ivar status: Indicates whether or not the encryption is enabled for container registry. Known + values are: "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.EncryptionStatus + :ivar key_vault_properties: Key vault properties. + :vartype key_vault_properties: ~azure.mgmt.containerregistry.models.KeyVaultProperties + """ + + status: Optional[Union[str, "_models.EncryptionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether or not the encryption is enabled for container registry. Known values are: + \"enabled\" and \"disabled\".""" + key_vault_properties: Optional["_models.KeyVaultProperties"] = rest_field( + name="keyVaultProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Key vault properties.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.EncryptionStatus"]] = None, + key_vault_properties: Optional["_models.KeyVaultProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str + :ivar target: The error target. + :vartype target: str + :ivar details: The error details. + :vartype details: list[~azure.mgmt.containerregistry.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.containerregistry.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[list["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.containerregistry.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventInfo(_Model): + """The basic information of an event. + + :ivar id: The event ID. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The event ID.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +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.models.EventRequestMessage + :ivar event_response_message: The event response message received from the service URI. + :vartype event_response_message: ~azure.mgmt.containerregistry.models.EventResponseMessage + """ + + event_request_message: Optional["_models.EventRequestMessage"] = rest_field( + name="eventRequestMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """The event request message sent to the service URI.""" + event_response_message: Optional["_models.EventResponseMessage"] = rest_field( + name="eventResponseMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """The event response message received from the service URI.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + event_request_message: Optional["_models.EventRequestMessage"] = None, + event_response_message: Optional["_models.EventResponseMessage"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventContent(_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.models.Target + :ivar request: The request that generated the event. + :vartype request: ~azure.mgmt.containerregistry.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.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.models.Source + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The event ID.""" + timestamp: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time at which the event occurred.""" + action: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The action that encompasses the provided event.""" + target: Optional["_models.Target"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The target of the event.""" + request: Optional["_models.Request"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The request that generated the event.""" + actor: Optional["_models.Actor"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The agent that initiated the event. For most situations, this could be from the authorization + context of the request.""" + source: Optional["_models.Source"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The registry node that generated the event. Put differently, while the actor initiates the + event, the source generates it.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + timestamp: Optional[datetime.datetime] = None, + action: Optional[str] = None, + target: Optional["_models.Target"] = None, + request: Optional["_models.Request"] = None, + actor: Optional["_models.Actor"] = None, + source: Optional["_models.Source"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventRequestMessage(_Model): + """The event request message sent to the service URI. + + :ivar content: The content of the event request message. + :vartype content: ~azure.mgmt.containerregistry.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 + """ + + content: Optional["_models.EventContent"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The content of the event request message.""" + headers: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The headers of the event request message.""" + method: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The HTTP method used to send the event request message.""" + request_uri: Optional[str] = rest_field( + name="requestUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The URI used to send the event request message.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The HTTP message version.""" + + @overload + def __init__( + self, + *, + content: Optional["_models.EventContent"] = None, + headers: Optional[dict[str, str]] = None, + method: Optional[str] = None, + request_uri: Optional[str] = None, + version: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class EventResponseMessage(_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 + """ + + content: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The content of the event response message.""" + headers: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The headers of the event response message.""" + reason_phrase: Optional[str] = rest_field( + name="reasonPhrase", visibility=["read", "create", "update", "delete", "query"] + ) + """The reason phrase of the event response message.""" + status_code: Optional[str] = rest_field( + name="statusCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The status code of the event response message.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The HTTP message version.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExportPolicy(_Model): + """The export policy for a container registry. + + :ivar status: The value that indicates whether the policy is enabled or not. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.ExportPolicyStatus + """ + + status: Optional[Union[str, "_models.ExportPolicyStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the policy is enabled or not. Known values are: \"enabled\" + and \"disabled\".""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.ExportPolicyStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GarbageCollectionProperties(_Model): + """The garbage collection properties of the connected registry. + + :ivar enabled: Indicates whether garbage collection is enabled for the connected registry. + :vartype enabled: bool + :ivar schedule: The cron expression indicating the schedule that the connected registry will + run garbage collection. + :vartype schedule: str + """ + + enabled: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates whether garbage collection is enabled for the connected registry.""" + schedule: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The cron expression indicating the schedule that the connected registry will run garbage + collection.""" + + @overload + def __init__( + self, + *, + enabled: Optional[bool] = None, + schedule: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GenerateCredentialsParameters(_Model): + """The parameters used to generate credentials for a specified token or user of a container + registry. + + :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. + :vartype expiry: ~datetime.datetime + :ivar name: Specifies name of the password which should be regenerated if any -- password1 or + password2. Known values are: "password1" and "password2". + :vartype name: str or ~azure.mgmt.containerregistry.models.TokenPasswordName + """ + + token_id: Optional[str] = rest_field(name="tokenId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the token for which credentials have to be generated.""" + expiry: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The expiry date of the generated credentials after which the credentials become invalid.""" + name: Optional[Union[str, "_models.TokenPasswordName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies name of the password which should be regenerated if any -- password1 or password2. + Known values are: \"password1\" and \"password2\".""" + + @overload + def __init__( + self, + *, + token_id: Optional[str] = None, + expiry: Optional[datetime.datetime] = None, + name: Optional[Union[str, "_models.TokenPasswordName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class GenerateCredentialsResult(_Model): + """The response from the GenerateCredentials 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.models.TokenPassword] + """ + + username: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The username for a container registry.""" + passwords: Optional[list["_models.TokenPassword"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of passwords for a container registry.""" + + @overload + def __init__( + self, + *, + username: Optional[str] = None, + passwords: Optional[list["_models.TokenPassword"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IdentityProperties(_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. Known values are: "SystemAssigned", "UserAssigned", + "SystemAssigned, UserAssigned", and "None". + :vartype type: str or ~azure.mgmt.containerregistry.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.models.UserIdentityProperties] + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of resource identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of resource.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity type. Known values are: \"SystemAssigned\", \"UserAssigned\", \"SystemAssigned, + UserAssigned\", and \"None\".""" + user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """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}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, + user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImportImageParameters(_Model): + """ImportImageParameters. + + :ivar source: The source of the image. Required. + :vartype source: ~azure.mgmt.containerregistry.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. Known values are: + "NoForce" and "Force". + :vartype mode: str or ~azure.mgmt.containerregistry.models.ImportMode + """ + + source: "_models.ImportSource" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The source of the image. Required.""" + target_tags: Optional[list[str]] = rest_field( + name="targetTags", visibility=["read", "create", "update", "delete", "query"] + ) + """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).""" + untagged_target_repositories: Optional[list[str]] = rest_field( + name="untaggedTargetRepositories", visibility=["read", "create", "update", "delete", "query"] + ) + """List of strings of repository names to do a manifest only copy. No tag will be created.""" + mode: Optional[Union[str, "_models.ImportMode"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """When Force, any existing target tags will be overwritten. When NoForce, any existing target + tags will fail the operation before any copying begins. Known values are: \"NoForce\" and + \"Force\".""" + + @overload + def __init__( + self, + *, + source: "_models.ImportSource", + target_tags: Optional[list[str]] = None, + untagged_target_repositories: Optional[list[str]] = None, + mode: Optional[Union[str, "_models.ImportMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImportSource(_Model): + """ImportSource. + + :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.models.ImportSourceCredentials + :ivar source_image: 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'). Required. + :vartype source_image: str + """ + + resource_id: Optional[str] = rest_field( + name="resourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource identifier of the source Azure Container Registry.""" + registry_uri: Optional[str] = rest_field( + name="registryUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The address of the source registry (e.g. 'mcr.microsoft.com').""" + credentials: Optional["_models.ImportSourceCredentials"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Credentials used when importing from a registry uri.""" + source_image: str = rest_field(name="sourceImage", visibility=["read", "create", "update", "delete", "query"]) + """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'). Required.""" + + @overload + def __init__( + self, + *, + source_image: str, + resource_id: Optional[str] = None, + registry_uri: Optional[str] = None, + credentials: Optional["_models.ImportSourceCredentials"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ImportSourceCredentials(_Model): + """ImportSourceCredentials. + + :ivar username: The username to authenticate with the source registry. + :vartype username: str + :ivar password: The password used to authenticate with the source registry. Required. + :vartype password: str + """ + + username: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The username to authenticate with the source registry.""" + password: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password used to authenticate with the source registry. Required.""" + + @overload + def __init__( + self, + *, + password: str, + username: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IPRule(_Model): + """IP rule with specific IP or IP range in CIDR format. + + :ivar action: The action of IP ACL rule. "Allow" + :vartype action: str or ~azure.mgmt.containerregistry.models.Action + :ivar ip_address_or_range: Specifies the IP or IP range in CIDR format. Only IPV4 address is + allowed. Required. + :vartype ip_address_or_range: str + """ + + action: Optional[Union[str, "_models.Action"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The action of IP ACL rule. \"Allow\"""" + ip_address_or_range: str = rest_field(name="value", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the IP or IP range in CIDR format. Only IPV4 address is allowed. Required.""" + + @overload + def __init__( + self, + *, + ip_address_or_range: str, + action: Optional[Union[str, "_models.Action"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class KeyVaultProperties(_Model): + """KeyVaultProperties. + + :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 + """ + + key_identifier: Optional[str] = rest_field( + name="keyIdentifier", visibility=["read", "create", "update", "delete", "query"] + ) + """Key vault uri to access the encryption key.""" + versioned_key_identifier: Optional[str] = rest_field(name="versionedKeyIdentifier", visibility=["read"]) + """The fully qualified key identifier that includes the version of the key that is actually used + for encryption.""" + identity: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The client id of the identity which will be used to access key vault.""" + key_rotation_enabled: Optional[bool] = rest_field(name="keyRotationEnabled", visibility=["read"]) + """Auto key rotation status for a CMK enabled registry.""" + last_key_rotation_timestamp: Optional[datetime.datetime] = rest_field( + name="lastKeyRotationTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp of the last successful key rotation.""" + + @overload + def __init__( + self, + *, + key_identifier: Optional[str] = None, + identity: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LoggingProperties(_Model): + """The logging properties of the connected registry. + + :ivar log_level: The verbosity of logs persisted on the connected registry. Known values are: + "Debug", "Information", "Warning", "Error", and "None". + :vartype log_level: str or ~azure.mgmt.containerregistry.models.LogLevel + :ivar audit_log_status: Indicates whether audit logs are enabled on the connected registry. + Known values are: "Enabled" and "Disabled". + :vartype audit_log_status: str or ~azure.mgmt.containerregistry.models.AuditLogStatus + """ + + log_level: Optional[Union[str, "_models.LogLevel"]] = rest_field( + name="logLevel", visibility=["read", "create", "update", "delete", "query"] + ) + """The verbosity of logs persisted on the connected registry. Known values are: \"Debug\", + \"Information\", \"Warning\", \"Error\", and \"None\".""" + audit_log_status: Optional[Union[str, "_models.AuditLogStatus"]] = rest_field( + name="auditLogStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether audit logs are enabled on the connected registry. Known values are: + \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + log_level: Optional[Union[str, "_models.LogLevel"]] = None, + audit_log_status: Optional[Union[str, "_models.AuditLogStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class LoginServerProperties(_Model): + """The login server properties of the connected registry. + + :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.models.TlsProperties + """ + + host: Optional[str] = rest_field(visibility=["read"]) + """The host of the connected registry. Can be FQDN or IP.""" + tls: Optional["_models.TlsProperties"] = rest_field(visibility=["read"]) + """The TLS properties of the connected registry login server.""" + + +class NetworkRuleSet(_Model): + """The network rule set for a container registry. + + :ivar default_action: The default action of allow or deny when no other rules match. Required. + Known values are: "Allow" and "Deny". + :vartype default_action: str or ~azure.mgmt.containerregistry.models.DefaultAction + :ivar ip_rules: The IP ACL rules. + :vartype ip_rules: list[~azure.mgmt.containerregistry.models.IPRule] + """ + + default_action: Union[str, "_models.DefaultAction"] = rest_field( + name="defaultAction", visibility=["read", "create", "update", "delete", "query"] + ) + """The default action of allow or deny when no other rules match. Required. Known values are: + \"Allow\" and \"Deny\".""" + ip_rules: Optional[list["_models.IPRule"]] = rest_field( + name="ipRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The IP ACL rules.""" + + @overload + def __init__( + self, + *, + default_action: Union[str, "_models.DefaultAction"], + ip_rules: Optional[list["_models.IPRule"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDefinition(_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.models.OperationDisplayDefinition + :ivar properties: The properties information for the container registry operation. + :vartype properties: ~azure.mgmt.containerregistry.models.OperationPropertiesDefinition + :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 + """ + + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The origin information of the container registry operation.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation name: {provider}/{resource}/{operation}.""" + display: Optional["_models.OperationDisplayDefinition"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The display information for the container registry operation.""" + properties: Optional["_models.OperationPropertiesDefinition"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties information for the container registry operation.""" + is_data_action: Optional[bool] = rest_field( + name="isDataAction", visibility=["read", "create", "update", "delete", "query"] + ) + """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 + `_.""" + + __flattened_items = ["service_specification"] + + @overload + def __init__( + self, + *, + origin: Optional[str] = None, + name: Optional[str] = None, + display: Optional["_models.OperationDisplayDefinition"] = None, + properties: Optional["_models.OperationPropertiesDefinition"] = None, + is_data_action: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class OperationDisplayDefinition(_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 + """ + + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource provider name: Microsoft.ContainerRegistry.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource on which the operation is performed.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operation that users can perform.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description for the operation.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationLogSpecificationDefinition(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Log name.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Log display name.""" + blob_duration: Optional[str] = rest_field( + name="blobDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Log blob duration.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + display_name: Optional[str] = None, + blob_duration: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationMetricSpecificationDefinition(_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 + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metric name.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric display name.""" + display_description: Optional[str] = rest_field( + name="displayDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric description.""" + unit: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Metric unit.""" + aggregation_type: Optional[str] = rest_field( + name="aggregationType", visibility=["read", "create", "update", "delete", "query"] + ) + """Metric aggregation type.""" + internal_metric_name: Optional[str] = rest_field( + name="internalMetricName", visibility=["read", "create", "update", "delete", "query"] + ) + """Internal metric name.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationPropertiesDefinition(_Model): + """The definition of Azure Monitoring properties. + + :ivar service_specification: The definition of Azure Monitoring service. + :vartype service_specification: + ~azure.mgmt.containerregistry.models.OperationServiceSpecificationDefinition + """ + + service_specification: Optional["_models.OperationServiceSpecificationDefinition"] = rest_field( + name="serviceSpecification", visibility=["read", "create", "update", "delete", "query"] + ) + """The definition of Azure Monitoring service.""" + + @overload + def __init__( + self, + *, + service_specification: Optional["_models.OperationServiceSpecificationDefinition"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationServiceSpecificationDefinition(_Model): + """The definition of Azure Monitoring list. + + :ivar metric_specifications: A list of Azure Monitoring metrics definition. + :vartype metric_specifications: + list[~azure.mgmt.containerregistry.models.OperationMetricSpecificationDefinition] + :ivar log_specifications: A list of Azure Monitoring log definitions. + :vartype log_specifications: + list[~azure.mgmt.containerregistry.models.OperationLogSpecificationDefinition] + """ + + metric_specifications: Optional[list["_models.OperationMetricSpecificationDefinition"]] = rest_field( + name="metricSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of Azure Monitoring metrics definition.""" + log_specifications: Optional[list["_models.OperationLogSpecificationDefinition"]] = rest_field( + name="logSpecifications", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of Azure Monitoring log definitions.""" + + @overload + def __init__( + self, + *, + metric_specifications: Optional[list["_models.OperationMetricSpecificationDefinition"]] = None, + log_specifications: Optional[list["_models.OperationLogSpecificationDefinition"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ParentProperties(_Model): + """The properties of the connected registry parent. + + :ivar id: The resource ID of the parent to which the connected registry will be associated. + :vartype id: str + :ivar sync_properties: The sync properties of the connected registry with its parent. Required. + :vartype sync_properties: ~azure.mgmt.containerregistry.models.SyncProperties + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the parent to which the connected registry will be associated.""" + sync_properties: "_models.SyncProperties" = rest_field( + name="syncProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The sync properties of the connected registry with its parent. Required.""" + + @overload + def __init__( + self, + *, + sync_properties: "_models.SyncProperties", + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Policies(_Model): + """The policies for a container registry. + + :ivar quarantine_policy: The quarantine policy for a container registry. + :vartype quarantine_policy: ~azure.mgmt.containerregistry.models.QuarantinePolicy + :ivar trust_policy: The content trust policy for a container registry. + :vartype trust_policy: ~azure.mgmt.containerregistry.models.TrustPolicy + :ivar retention_policy: The retention policy for a container registry. + :vartype retention_policy: ~azure.mgmt.containerregistry.models.RetentionPolicy + :ivar export_policy: The export policy for a container registry. + :vartype export_policy: ~azure.mgmt.containerregistry.models.ExportPolicy + :ivar azure_ad_authentication_as_arm_policy: The policy for using Azure Resource Manager + audience token for a container registry. + :vartype azure_ad_authentication_as_arm_policy: + ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicy + """ + + quarantine_policy: Optional["_models.QuarantinePolicy"] = rest_field( + name="quarantinePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The quarantine policy for a container registry.""" + trust_policy: Optional["_models.TrustPolicy"] = rest_field( + name="trustPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The content trust policy for a container registry.""" + retention_policy: Optional["_models.RetentionPolicy"] = rest_field( + name="retentionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The retention policy for a container registry.""" + export_policy: Optional["_models.ExportPolicy"] = rest_field( + name="exportPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The export policy for a container registry.""" + azure_ad_authentication_as_arm_policy: Optional["_models.AzureADAuthenticationAsArmPolicy"] = rest_field( + name="azureADAuthenticationAsArmPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy for using Azure Resource Manager audience token for a container registry.""" + + @overload + def __init__( + self, + *, + quarantine_policy: Optional["_models.QuarantinePolicy"] = None, + trust_policy: Optional["_models.TrustPolicy"] = None, + retention_policy: Optional["_models.RetentionPolicy"] = None, + export_policy: Optional["_models.ExportPolicy"] = None, + azure_ad_authentication_as_arm_policy: Optional["_models.AzureADAuthenticationAsArmPolicy"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """The Private Endpoint resource. + + :ivar id: This is private endpoint resource created with Microsoft.Network resource provider. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """This is private endpoint resource created with Microsoft.Network resource provider.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnection(ProxyResource): + """An object that represents a private endpoint connection for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of a private endpoint connection. + :vartype properties: ~azure.mgmt.containerregistry.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of a private endpoint connection.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionProperties(_Model): + """The properties of a private endpoint connection. + + :ivar private_endpoint: The resource of private endpoint. + :vartype private_endpoint: ~azure.mgmt.containerregistry.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.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of private endpoint connection resource. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + """ + + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource of private endpoint.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between service consumer and + provider.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of private endpoint connection resource. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResource(Resource): + """A private link resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: A resource that supports private link capabilities. + :vartype properties: ~azure.mgmt.containerregistry.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """A resource that supports private link capabilities.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateLinkResourceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkResourceProperties(_Model): + """Properties of a private link resource. + + :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] + """ + + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private link resource group id.""" + required_members: Optional[list[str]] = rest_field(name="requiredMembers", visibility=["read"]) + """The private link resource required member names.""" + required_zone_names: Optional[list[str]] = rest_field( + name="requiredZoneNames", visibility=["read", "create", "update", "delete", "query"] + ) + """The private link resource private link DNS zone name.""" + + @overload + def __init__( + self, + *, + required_zone_names: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_Model): + """The state of a private link service connection. + + :ivar status: The private link service connection status. Known values are: "Approved", + "Pending", "Rejected", and "Disconnected". + :vartype status: str or ~azure.mgmt.containerregistry.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. Known values are: "None" and "Recreate". + :vartype actions_required: str or ~azure.mgmt.containerregistry.models.ActionsRequired + """ + + status: Optional[Union[str, "_models.ConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The private link service connection status. Known values are: \"Approved\", \"Pending\", + \"Rejected\", and \"Disconnected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The description for connection status. For example if connection is rejected it can indicate + reason for rejection.""" + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer. + Known values are: \"None\" and \"Recreate\".""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.ConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class QuarantinePolicy(_Model): + """The quarantine policy for a container registry. + + :ivar status: The value that indicates whether the policy is enabled or not. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus + """ + + status: Optional[Union[str, "_models.PolicyStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the policy is enabled or not. Known values are: \"enabled\" + and \"disabled\".""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PolicyStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegenerateCredentialParameters(_Model): + """The parameters used to regenerate the login credential. + + :ivar name: Specifies name of the password which should be regenerated -- password or + password2. Required. Known values are: "password" and "password2". + :vartype name: str or ~azure.mgmt.containerregistry.models.PasswordName + """ + + name: Union[str, "_models.PasswordName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies name of the password which should be regenerated -- password or password2. Required. + Known values are: \"password\" and \"password2\".""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.PasswordName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Registry(TrackedResource): + """An object that represents a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The properties of the container registry. + :vartype properties: ~azure.mgmt.containerregistry.models.RegistryProperties + :ivar sku: The SKU of the container registry. Required. + :vartype sku: ~azure.mgmt.containerregistry.models.Sku + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties + """ + + properties: Optional["_models.RegistryProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the container registry.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU of the container registry. Required.""" + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the container registry.""" + + @overload + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.RegistryProperties"] = None, + identity: Optional["_models.IdentityProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryListCredentialsResult(_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.models.RegistryPassword] + """ + + username: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The username for a container registry.""" + passwords: Optional[list["_models.RegistryPassword"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of passwords for a container registry.""" + + @overload + def __init__( + self, + *, + username: Optional[str] = None, + passwords: Optional[list["_models.RegistryPassword"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryNameCheckRequest(_Model): + """A request to check whether a container registry name is available. + + :ivar name: The name of the container registry. Required. + :vartype name: str + :ivar type: The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Required. "Microsoft.ContainerRegistry/registries" + :vartype type: str or ~azure.mgmt.containerregistry.models.ContainerRegistryResourceType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the container registry. Required.""" + type: Union[str, "_models.ContainerRegistryResourceType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource type of the container registry. This field must be set to + 'Microsoft.ContainerRegistry/registries'. Required. \"Microsoft.ContainerRegistry/registries\"""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.ContainerRegistryResourceType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryNameStatus(_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 + """ + + name_available: Optional[bool] = rest_field( + name="nameAvailable", visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the name is available.""" + reason: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If any, the reason that the name is not available.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """If any, the error message that provides more detail for the reason that the name is not + available.""" + + @overload + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryPassword(_Model): + """The login password for the container registry. + + :ivar name: The password name. Known values are: "password" and "password2". + :vartype name: str or ~azure.mgmt.containerregistry.models.PasswordName + :ivar value: The password value. + :vartype value: str + """ + + name: Optional[Union[str, "_models.PasswordName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The password name. Known values are: \"password\" and \"password2\".""" + value: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The password value.""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.PasswordName"]] = None, + value: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryProperties(_Model): + """The properties of a container registry. + + :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. Known values are: "Creating", "Updating", "Deleting", "Succeeded", + "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + :ivar status: The status of the container registry at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.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.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: ~azure.mgmt.containerregistry.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.models.PrivateEndpointConnection] + :ivar public_network_access: Whether or not public network access is allowed for the container + registry. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.containerregistry.models.PublicNetworkAccess + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Known values are: "AzureServices" and "None". + :vartype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions + :ivar network_rule_bypass_allowed_for_tasks: Whether or not Tasks allowed to bypass the network + rules for this container registry. + :vartype network_rule_bypass_allowed_for_tasks: bool + :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. + Known values are: "Enabled" and "Disabled". + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool + :ivar role_assignment_mode: Determines registry role assignment mode. Known values are: + "AbacRepositoryPermissions" and "LegacyRegistryPermissions". + :vartype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode + """ + + login_server: Optional[str] = rest_field(name="loginServer", visibility=["read"]) + """The URL that can be used to log into the container registry.""" + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of the container registry in ISO8601 format.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the container registry at the time the operation was called. Known + values are: \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and + \"Canceled\".""" + status: Optional["_models.Status"] = rest_field(visibility=["read"]) + """The status of the container registry at the time the operation was called.""" + admin_user_enabled: Optional[bool] = rest_field( + name="adminUserEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the admin user is enabled.""" + network_rule_set: Optional["_models.NetworkRuleSet"] = rest_field( + name="networkRuleSet", visibility=["read", "create", "update", "delete", "query"] + ) + """The network rule set for a container registry.""" + policies: Optional["_models.Policies"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The policies for a container registry.""" + encryption: Optional["_models.EncryptionProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The encryption settings of container registry.""" + data_endpoint_enabled: Optional[bool] = rest_field( + name="dataEndpointEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable a single data endpoint per region for serving data.""" + data_endpoint_host_names: Optional[list[str]] = rest_field(name="dataEndpointHostNames", visibility=["read"]) + """List of host names that will serve data when dataEndpointEnabled is true.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connections for a container registry.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not public network access is allowed for the container registry. Known values are: + \"Enabled\" and \"Disabled\".""" + network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = rest_field( + name="networkRuleBypassOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to allow trusted Azure services to access a network restricted registry. Known values + are: \"AzureServices\" and \"None\".""" + network_rule_bypass_allowed_for_tasks: Optional[bool] = rest_field( + name="networkRuleBypassAllowedForTasks", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not Tasks allowed to bypass the network rules for this container registry.""" + zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = rest_field( + name="zoneRedundancy", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not zone redundancy is enabled for this container registry. Known values are: + \"Enabled\" and \"Disabled\".""" + anonymous_pull_enabled: Optional[bool] = rest_field( + name="anonymousPullEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables registry-wide pull from unauthenticated clients.""" + role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = rest_field( + name="roleAssignmentMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines registry role assignment mode. Known values are: \"AbacRepositoryPermissions\" and + \"LegacyRegistryPermissions\".""" + + @overload + def __init__( + self, + *, + admin_user_enabled: Optional[bool] = None, + network_rule_set: Optional["_models.NetworkRuleSet"] = None, + policies: Optional["_models.Policies"] = None, + encryption: Optional["_models.EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + network_rule_bypass_allowed_for_tasks: Optional[bool] = None, + zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = None, + anonymous_pull_enabled: Optional[bool] = None, + role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryPropertiesUpdateParameters(_Model): + """The parameters for updating the properties of a container registry. + + :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.models.NetworkRuleSet + :ivar policies: The policies for a container registry. + :vartype policies: ~azure.mgmt.containerregistry.models.Policies + :ivar encryption: The encryption settings of container registry. + :vartype encryption: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.containerregistry.models.PublicNetworkAccess + :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network + restricted registry. Known values are: "AzureServices" and "None". + :vartype network_rule_bypass_options: str or + ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions + :ivar network_rule_bypass_allowed_for_tasks: Whether to allow ACR Tasks service to access a + network restricted registry. + :vartype network_rule_bypass_allowed_for_tasks: bool + :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. + :vartype anonymous_pull_enabled: bool + :ivar role_assignment_mode: Determines registry role assignment mode. Known values are: + "AbacRepositoryPermissions" and "LegacyRegistryPermissions". + :vartype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode + """ + + admin_user_enabled: Optional[bool] = rest_field( + name="adminUserEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the admin user is enabled.""" + network_rule_set: Optional["_models.NetworkRuleSet"] = rest_field( + name="networkRuleSet", visibility=["read", "create", "update", "delete", "query"] + ) + """The network rule set for a container registry.""" + policies: Optional["_models.Policies"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The policies for a container registry.""" + encryption: Optional["_models.EncryptionProperty"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The encryption settings of container registry.""" + data_endpoint_enabled: Optional[bool] = rest_field( + name="dataEndpointEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable a single data endpoint per region for serving data.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not public network access is allowed for the container registry. Known values are: + \"Enabled\" and \"Disabled\".""" + network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = rest_field( + name="networkRuleBypassOptions", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to allow trusted Azure services to access a network restricted registry. Known values + are: \"AzureServices\" and \"None\".""" + network_rule_bypass_allowed_for_tasks: Optional[bool] = rest_field( + name="networkRuleBypassAllowedForTasks", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether to allow ACR Tasks service to access a network restricted registry.""" + anonymous_pull_enabled: Optional[bool] = rest_field( + name="anonymousPullEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables registry-wide pull from unauthenticated clients.""" + role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = rest_field( + name="roleAssignmentMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines registry role assignment mode. Known values are: \"AbacRepositoryPermissions\" and + \"LegacyRegistryPermissions\".""" + + @overload + def __init__( + self, + *, + admin_user_enabled: Optional[bool] = None, + network_rule_set: Optional["_models.NetworkRuleSet"] = None, + policies: Optional["_models.Policies"] = None, + encryption: Optional["_models.EncryptionProperty"] = None, + data_endpoint_enabled: Optional[bool] = None, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, + network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, + network_rule_bypass_allowed_for_tasks: Optional[bool] = None, + anonymous_pull_enabled: Optional[bool] = None, + role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryUpdateParameters(_Model): + """The parameters for updating a container registry. + + :ivar identity: The identity of the container registry. + :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties + :ivar 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.models.Sku + :ivar properties: The properties that the container registry will be updated with. + :vartype properties: ~azure.mgmt.containerregistry.models.RegistryPropertiesUpdateParameters + """ + + identity: Optional["_models.IdentityProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity of the container registry.""" + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags for the container registry.""" + sku: Optional["_models.Sku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU of the container registry.""" + properties: Optional["_models.RegistryPropertiesUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties that the container registry will be updated with.""" + + __flattened_items = [ + "admin_user_enabled", + "network_rule_set", + "policies", + "encryption", + "data_endpoint_enabled", + "public_network_access", + "network_rule_bypass_options", + "network_rule_bypass_allowed_for_tasks", + "anonymous_pull_enabled", + "role_assignment_mode", + ] + + @overload + def __init__( + self, + *, + identity: Optional["_models.IdentityProperties"] = None, + tags: Optional[dict[str, str]] = None, + sku: Optional["_models.Sku"] = None, + properties: Optional["_models.RegistryPropertiesUpdateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class RegistryUsage(_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: int + :ivar current_value: The current value of the usage. + :vartype current_value: int + :ivar unit: The unit of measurement. Known values are: "Count" and "Bytes". + :vartype unit: str or ~azure.mgmt.containerregistry.models.RegistryUsageUnit + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the usage.""" + limit: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The limit of the usage.""" + current_value: Optional[int] = rest_field( + name="currentValue", visibility=["read", "create", "update", "delete", "query"] + ) + """The current value of the usage.""" + unit: Optional[Union[str, "_models.RegistryUsageUnit"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The unit of measurement. Known values are: \"Count\" and \"Bytes\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + limit: Optional[int] = None, + current_value: Optional[int] = None, + unit: Optional[Union[str, "_models.RegistryUsageUnit"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RegistryUsageListResult(_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.models.RegistryUsage] + """ + + value: Optional[list["_models.RegistryUsage"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of container registry quota usages.""" + + @overload + def __init__( + self, + *, + value: Optional[list["_models.RegistryUsage"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Replication(TrackedResource): + """An object that represents a replication for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The properties of the replication. + :vartype properties: ~azure.mgmt.containerregistry.models.ReplicationProperties + """ + + properties: Optional["_models.ReplicationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the replication.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ReplicationProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReplicationProperties(_Model): + """The properties of a replication. + + :ivar provisioning_state: The provisioning state of the replication at the time the operation + was called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and + "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + :ivar status: The status of the replication at the time the operation was called. + :vartype status: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". + :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the replication at the time the operation was called. Known values + are: \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + status: Optional["_models.Status"] = rest_field(visibility=["read"]) + """The status of the replication at the time the operation was called.""" + region_endpoint_enabled: Optional[bool] = rest_field( + name="regionEndpointEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = rest_field( + name="zoneRedundancy", visibility=["read", "create", "update", "delete", "query"] + ) + """Whether or not zone redundancy is enabled for this container registry replication. Known values + are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + region_endpoint_enabled: Optional[bool] = None, + zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ReplicationUpdateParameters(_Model): + """The parameters for updating a replication. + + :ivar tags: The tags for the replication. + :vartype tags: dict[str, str] + :ivar properties: The parameters for updating a replication's properties. + :vartype properties: ~azure.mgmt.containerregistry.models.ReplicationUpdateParametersProperties + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags for the replication.""" + properties: Optional["_models.ReplicationUpdateParametersProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters for updating a replication's properties.""" + + __flattened_items = ["region_endpoint_enabled"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.ReplicationUpdateParametersProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class ReplicationUpdateParametersProperties(_Model): + """ReplicationUpdateParametersProperties. + + :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 + """ + + region_endpoint_enabled: Optional[bool] = rest_field( + name="regionEndpointEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + region_endpoint_enabled: Optional[bool] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Request(_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 + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the request that initiated the event.""" + addr: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The IP or hostname and possibly port of the client connection that initiated the event. This is + the RemoteAddr from the standard http request.""" + host: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The externally accessible hostname of the registry instance, as specified by the http host + header on incoming requests.""" + method: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The request method that generated the event.""" + useragent: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user agent header of the request.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + addr: Optional[str] = None, + host: Optional[str] = None, + method: Optional[str] = None, + useragent: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RetentionPolicy(_Model): + """The retention policy for a container registry. + + :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. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus + """ + + days: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of days to retain an untagged manifest after which it gets purged.""" + last_updated_time: Optional[datetime.datetime] = rest_field( + name="lastUpdatedTime", visibility=["read"], format="rfc3339" + ) + """The timestamp when the policy was last updated.""" + status: Optional[Union[str, "_models.PolicyStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the policy is enabled or not. Known values are: \"enabled\" + and \"disabled\".""" + + @overload + def __init__( + self, + *, + days: Optional[int] = None, + status: Optional[Union[str, "_models.PolicyStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScopeMap(ProxyResource): + """An object that represents a scope map for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of the scope map. + :vartype properties: ~azure.mgmt.containerregistry.models.ScopeMapProperties + """ + + properties: Optional["_models.ScopeMapProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the scope map.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ScopeMapProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScopeMapProperties(_Model): + """The properties of a scope map. + + :ivar description: The user friendly description of the scope map. + :vartype description: str + :ivar type: The type of the scope map. E.g. BuildIn scope map. + :vartype type: str + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + :ivar actions: The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. Required. + :vartype actions: list[str] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user friendly description of the scope map.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the scope map. E.g. BuildIn scope map.""" + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of scope map.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + actions: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of scoped permissions for registry artifacts. + E.g. repositories/repository-name/content/read, + repositories/repository-name/metadata/write. Required.""" + + @overload + def __init__( + self, + *, + actions: list[str], + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScopeMapPropertiesUpdateParameters(_Model): + """The update parameters for scope map properties. + + :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. + :vartype actions: list[str] + """ + + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The user friendly description of the scope map.""" + actions: Optional[list[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The list of scope permissions for registry artifacts. + E.g. repositories/repository-name/pull, + repositories/repository-name/delete.""" + + @overload + def __init__( + self, + *, + description: Optional[str] = None, + actions: Optional[list[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScopeMapUpdateParameters(_Model): + """The properties for updating the scope map. + + :ivar properties: The update parameters for scope map properties. + :vartype properties: ~azure.mgmt.containerregistry.models.ScopeMapPropertiesUpdateParameters + """ + + properties: Optional["_models.ScopeMapPropertiesUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The update parameters for scope map properties.""" + + __flattened_items = ["description", "actions"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ScopeMapPropertiesUpdateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class Sku(_Model): + """The SKU of a container registry. + + :ivar name: The SKU name of the container registry. Required for registry creation. Required. + Known values are: "Classic", "Basic", "Standard", and "Premium". + :vartype name: str or ~azure.mgmt.containerregistry.models.SkuName + :ivar tier: The SKU tier based on the SKU name. Known values are: "Classic", "Basic", + "Standard", and "Premium". + :vartype tier: str or ~azure.mgmt.containerregistry.models.SkuTier + """ + + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The SKU name of the container registry. Required for registry creation. Required. Known values + are: \"Classic\", \"Basic\", \"Standard\", and \"Premium\".""" + tier: Optional[Union[str, "_models.SkuTier"]] = rest_field(visibility=["read"]) + """The SKU tier based on the SKU name. Known values are: \"Classic\", \"Basic\", \"Standard\", and + \"Premium\".""" + + @overload + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Source(_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 + """ + + addr: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + instance_id: Optional[str] = rest_field( + name="instanceID", visibility=["read", "create", "update", "delete", "query"] + ) + """The running instance of an application. Changes after each restart.""" + + @overload + def __init__( + self, + *, + addr: Optional[str] = None, + instance_id: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Status(_Model): + """The status of an Azure resource at the time the operation was called. + + :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 + """ + + display_status: Optional[str] = rest_field(name="displayStatus", visibility=["read"]) + """The short label for the status.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The detailed message for the status, including alerts and error messages.""" + timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The timestamp when the status was changed to the current value.""" + + +class StatusDetailProperties(_Model): + """The status detail properties of the connected registry. + + :ivar type: The component of the connected registry corresponding to the status. + :vartype type: str + :ivar code: The HTTP status code. + :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 + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The component of the connected registry corresponding to the status.""" + code: Optional[str] = rest_field(visibility=["read"]) + """The HTTP status code.""" + description: Optional[str] = rest_field(visibility=["read"]) + """The description of the status.""" + timestamp: Optional[datetime.datetime] = rest_field(visibility=["read"], format="rfc3339") + """The timestamp of the status.""" + correlation_id: Optional[str] = rest_field(name="correlationId", visibility=["read"]) + """The correlation ID of the status.""" + + +class SyncProperties(_Model): + """The sync properties of the connected registry with its parent. + + :ivar token_id: The resource ID of the ACR token used to authenticate the connected registry to + its parent during sync. Required. + :vartype token_id: str + :ivar schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :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. + :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. + Required. + :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 + :ivar gateway_endpoint: The gateway endpoint used by the connected registry to communicate with + its parent. + :vartype gateway_endpoint: str + """ + + token_id: str = rest_field(name="tokenId", visibility=["read", "create", "update", "delete", "query"]) + """The resource ID of the ACR token used to authenticate the connected registry to its parent + during sync. Required.""" + schedule: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The cron expression indicating the schedule that the connected registry will sync with its + parent.""" + sync_window: Optional[datetime.timedelta] = rest_field( + name="syncWindow", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + message_ttl: datetime.timedelta = rest_field( + name="messageTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """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. Required.""" + last_sync_time: Optional[datetime.datetime] = rest_field(name="lastSyncTime", visibility=["read"], format="rfc3339") + """The last time a sync occurred between the connected registry and its parent.""" + gateway_endpoint: Optional[str] = rest_field(name="gatewayEndpoint", visibility=["read"]) + """The gateway endpoint used by the connected registry to communicate with its parent.""" + + @overload + def __init__( + self, + *, + token_id: str, + message_ttl: datetime.timedelta, + schedule: Optional[str] = None, + sync_window: Optional[datetime.timedelta] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SyncUpdateProperties(_Model): + """The parameters for updating the sync properties of the connected registry with its parent. + + :ivar schedule: The cron expression indicating the schedule that the connected registry will + sync with its parent. + :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. + :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. + :vartype message_ttl: ~datetime.timedelta + """ + + schedule: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The cron expression indicating the schedule that the connected registry will sync with its + parent.""" + sync_window: Optional[datetime.timedelta] = rest_field( + name="syncWindow", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + message_ttl: Optional[datetime.timedelta] = rest_field( + name="messageTtl", visibility=["read", "create", "update", "delete", "query"] + ) + """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.""" + + @overload + def __init__( + self, + *, + schedule: Optional[str] = None, + sync_window: Optional[datetime.timedelta] = None, + message_ttl: Optional[datetime.timedelta] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Target(_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: int + :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: int + :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 + """ + + media_type: Optional[str] = rest_field(name="mediaType", visibility=["read", "create", "update", "delete", "query"]) + """The MIME type of the referenced object.""" + size: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of bytes of the content. Same as Length field.""" + digest: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The digest of the content, as defined by the Registry V2 HTTP API Specification.""" + length: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of bytes of the content. Same as Size field.""" + repository: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The repository name.""" + url: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The direct URL to the content.""" + tag: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tag name.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the artifact.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the artifact.""" + + @overload + 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, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TlsCertificateProperties(_Model): + """The TLS certificate properties of the connected registry login server. + + :ivar type: The type of certificate location. "LocalDirectory" + :vartype type: str or ~azure.mgmt.containerregistry.models.CertificateType + :ivar location: Indicates the location of the certificates. + :vartype location: str + """ + + type: Optional[Union[str, "_models.CertificateType"]] = rest_field(visibility=["read"]) + """The type of certificate location. \"LocalDirectory\"""" + location: Optional[str] = rest_field(visibility=["read"]) + """Indicates the location of the certificates.""" + + +class TlsProperties(_Model): + """The TLS properties of the connected registry login server. + + :ivar status: Indicates whether HTTPS is enabled for the login server. Known values are: + "Enabled" and "Disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.TlsStatus + :ivar certificate: The certificate used to configure HTTPS for the login server. + :vartype certificate: ~azure.mgmt.containerregistry.models.TlsCertificateProperties + """ + + status: Optional[Union[str, "_models.TlsStatus"]] = rest_field(visibility=["read"]) + """Indicates whether HTTPS is enabled for the login server. Known values are: \"Enabled\" and + \"Disabled\".""" + certificate: Optional["_models.TlsCertificateProperties"] = rest_field(visibility=["read"]) + """The certificate used to configure HTTPS for the login server.""" + + +class Token(ProxyResource): + """An object that represents a token for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar properties: The properties of the token. + :vartype properties: ~azure.mgmt.containerregistry.models.TokenProperties + """ + + properties: Optional["_models.TokenProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the token.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.TokenProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TokenCertificate(_Model): + """The properties of a certificate used for authenticating a token. + + :ivar name: Known values are: "certificate1" and "certificate2". + :vartype name: str or ~azure.mgmt.containerregistry.models.TokenCertificateName + :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. + :vartype encoded_pem_certificate: str + """ + + name: Optional[Union[str, "_models.TokenCertificateName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Known values are: \"certificate1\" and \"certificate2\".""" + expiry: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The expiry datetime of the certificate.""" + thumbprint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The thumbprint of the certificate.""" + encoded_pem_certificate: Optional[str] = rest_field( + name="encodedPemCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Base 64 encoded string of the public certificate1 in PEM format that will be used for + authenticating the token.""" + + @overload + def __init__( + self, + *, + name: Optional[Union[str, "_models.TokenCertificateName"]] = None, + expiry: Optional[datetime.datetime] = None, + thumbprint: Optional[str] = None, + encoded_pem_certificate: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TokenCredentialsProperties(_Model): + """The properties of the credentials that can be used for authenticating the token. + + :ivar certificates: + :vartype certificates: list[~azure.mgmt.containerregistry.models.TokenCertificate] + :ivar passwords: + :vartype passwords: list[~azure.mgmt.containerregistry.models.TokenPassword] + """ + + certificates: Optional[list["_models.TokenCertificate"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + passwords: Optional[list["_models.TokenPassword"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + + @overload + def __init__( + self, + *, + certificates: Optional[list["_models.TokenCertificate"]] = None, + passwords: Optional[list["_models.TokenPassword"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TokenPassword(_Model): + """The password that will be used for authenticating the token of a container registry. + + :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". Known values are: "password1" and + "password2". + :vartype name: str or ~azure.mgmt.containerregistry.models.TokenPasswordName + :ivar value: The password value. + :vartype value: str + """ + + creation_time: Optional[datetime.datetime] = rest_field( + name="creationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The creation datetime of the password.""" + expiry: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The expiry datetime of the password.""" + name: Optional[Union[str, "_models.TokenPasswordName"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The password name \"password1\" or \"password2\". Known values are: \"password1\" and + \"password2\".""" + value: Optional[str] = rest_field(visibility=["read"]) + """The password value.""" + + @overload + def __init__( + self, + *, + creation_time: Optional[datetime.datetime] = None, + expiry: Optional[datetime.datetime] = None, + name: Optional[Union[str, "_models.TokenPasswordName"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TokenProperties(_Model): + """The properties of a token. + + :ivar creation_date: The creation date of scope map. + :vartype creation_date: ~datetime.datetime + :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", + "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :vartype scope_map_id: str + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.models.TokenCredentialsProperties + :ivar status: The status of the token example enabled or disabled. Known values are: "enabled" + and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.TokenStatus + """ + + creation_date: Optional[datetime.datetime] = rest_field(name="creationDate", visibility=["read"], format="rfc3339") + """The creation date of scope map.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """Provisioning state of the resource. Known values are: \"Creating\", \"Updating\", \"Deleting\", + \"Succeeded\", \"Failed\", and \"Canceled\".""" + scope_map_id: Optional[str] = rest_field( + name="scopeMapId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the scope map to which the token will be associated with.""" + credentials: Optional["_models.TokenCredentialsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials that can be used for authenticating the token.""" + status: Optional[Union[str, "_models.TokenStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the token example enabled or disabled. Known values are: \"enabled\" and + \"disabled\".""" + + @overload + def __init__( + self, + *, + scope_map_id: Optional[str] = None, + credentials: Optional["_models.TokenCredentialsProperties"] = None, + status: Optional[Union[str, "_models.TokenStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TokenUpdateParameters(_Model): + """The parameters for updating a token. + + :ivar properties: The properties of the token update parameters. + :vartype properties: ~azure.mgmt.containerregistry.models.TokenUpdateProperties + """ + + properties: Optional["_models.TokenUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the token update parameters.""" + + __flattened_items = ["scope_map_id", "status", "credentials"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.TokenUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class TokenUpdateProperties(_Model): + """The parameters for updating token properties. + + :ivar scope_map_id: The resource ID of the scope map to which the token will be associated + with. + :vartype scope_map_id: str + :ivar status: The status of the token example enabled or disabled. Known values are: "enabled" + and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.TokenStatus + :ivar credentials: The credentials that can be used for authenticating the token. + :vartype credentials: ~azure.mgmt.containerregistry.models.TokenCredentialsProperties + """ + + scope_map_id: Optional[str] = rest_field( + name="scopeMapId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource ID of the scope map to which the token will be associated with.""" + status: Optional[Union[str, "_models.TokenStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the token example enabled or disabled. Known values are: \"enabled\" and + \"disabled\".""" + credentials: Optional["_models.TokenCredentialsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The credentials that can be used for authenticating the token.""" + + @overload + def __init__( + self, + *, + scope_map_id: Optional[str] = None, + status: Optional[Union[str, "_models.TokenStatus"]] = None, + credentials: Optional["_models.TokenCredentialsProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TrustPolicy(_Model): + """The content trust policy for a container registry. + + :ivar type: The type of trust policy. "Notary" + :vartype type: str or ~azure.mgmt.containerregistry.models.TrustPolicyType + :ivar status: The value that indicates whether the policy is enabled or not. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus + """ + + type: Optional[Union[str, "_models.TrustPolicyType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of trust policy. \"Notary\"""" + status: Optional[Union[str, "_models.PolicyStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The value that indicates whether the policy is enabled or not. Known values are: \"enabled\" + and \"disabled\".""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.TrustPolicyType"]] = None, + status: Optional[Union[str, "_models.PolicyStatus"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UserIdentityProperties(_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 + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of user assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client id of user assigned identity.""" + + +class Webhook(TrackedResource): + """An object that represents a webhook for a container registry. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the private link resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The properties of the webhook. + :vartype properties: ~azure.mgmt.containerregistry.models.WebhookProperties + """ + + properties: Optional["_models.WebhookProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the webhook.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WebhookProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookCreateParameters(_Model): + """The parameters for creating a webhook. + + :ivar tags: The tags for the webhook. + :vartype tags: dict[str, str] + :ivar location: The location of the webhook. This cannot be changed after the resource is + created. Required. + :vartype location: str + :ivar properties: The properties that the webhook will be created with. + :vartype properties: ~azure.mgmt.containerregistry.models.WebhookPropertiesCreateParameters + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags for the webhook.""" + location: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The location of the webhook. This cannot be changed after the resource is created. Required.""" + properties: Optional["_models.WebhookPropertiesCreateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties that the webhook will be created with.""" + + __flattened_items = ["service_uri", "custom_headers", "status", "scope", "actions"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WebhookPropertiesCreateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) + + +class WebhookProperties(_Model): + """The properties of a webhook. + + :ivar status: The status of the webhook at the time the operation was called. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.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. Required. + :vartype actions: list[str or ~azure.mgmt.containerregistry.models.WebhookAction] + :ivar provisioning_state: The provisioning state of the webhook at the time the operation was + called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and + "Canceled". + :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState + """ + + status: Optional[Union[str, "_models.WebhookStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the webhook at the time the operation was called. Known values are: \"enabled\" + and \"disabled\".""" + scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + actions: list[Union[str, "_models.WebhookAction"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of actions that trigger the webhook to post notifications. Required.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the webhook at the time the operation was called. Known values are: + \"Creating\", \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + actions: list[Union[str, "_models.WebhookAction"]], + status: Optional[Union[str, "_models.WebhookStatus"]] = None, + scope: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookPropertiesCreateParameters(_Model): + """The parameters for creating the properties of a webhook. + + :ivar service_uri: The service URI for the webhook to post notifications. Required. + :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. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.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. Required. + :vartype actions: list[str or ~azure.mgmt.containerregistry.models.WebhookAction] + """ + + service_uri: str = rest_field(name="serviceUri", visibility=["read", "create", "update", "delete", "query"]) + """The service URI for the webhook to post notifications. Required.""" + custom_headers: Optional[dict[str, str]] = rest_field( + name="customHeaders", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom headers that will be added to the webhook notifications.""" + status: Optional[Union[str, "_models.WebhookStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the webhook at the time the operation was called. Known values are: \"enabled\" + and \"disabled\".""" + scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + actions: list[Union[str, "_models.WebhookAction"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of actions that trigger the webhook to post notifications. Required.""" + + @overload + def __init__( + self, + *, + service_uri: str, + actions: list[Union[str, "_models.WebhookAction"]], + custom_headers: Optional[dict[str, str]] = None, + status: Optional[Union[str, "_models.WebhookStatus"]] = None, + scope: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookPropertiesUpdateParameters(_Model): + """The parameters for updating the properties of a webhook. + + :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. Known values are: + "enabled" and "disabled". + :vartype status: str or ~azure.mgmt.containerregistry.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.models.WebhookAction] + """ + + service_uri: Optional[str] = rest_field( + name="serviceUri", visibility=["read", "create", "update", "delete", "query"] + ) + """The service URI for the webhook to post notifications.""" + custom_headers: Optional[dict[str, str]] = rest_field( + name="customHeaders", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom headers that will be added to the webhook notifications.""" + status: Optional[Union[str, "_models.WebhookStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status of the webhook at the time the operation was called. Known values are: \"enabled\" + and \"disabled\".""" + scope: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """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.""" + actions: Optional[list[Union[str, "_models.WebhookAction"]]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of actions that trigger the webhook to post notifications.""" + + @overload + def __init__( + self, + *, + service_uri: Optional[str] = None, + custom_headers: Optional[dict[str, str]] = None, + status: Optional[Union[str, "_models.WebhookStatus"]] = None, + scope: Optional[str] = None, + actions: Optional[list[Union[str, "_models.WebhookAction"]]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class WebhookUpdateParameters(_Model): + """The parameters for updating a webhook. + + :ivar tags: The tags for the webhook. + :vartype tags: dict[str, str] + :ivar properties: The properties that the webhook will be updated with. + :vartype properties: ~azure.mgmt.containerregistry.models.WebhookPropertiesUpdateParameters + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The tags for the webhook.""" + properties: Optional["_models.WebhookPropertiesUpdateParameters"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties that the webhook will be updated with.""" + + __flattened_items = ["service_uri", "custom_headers", "status", "scope", "actions"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.WebhookPropertiesUpdateParameters"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} + super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models_py3.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models_py3.py deleted file mode 100644 index 1c62020471b4..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models_py3.py +++ /dev/null @@ -1,7811 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from collections.abc import MutableMapping -import datetime -from typing import Any, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] - - -class ActivationProperties(_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. Known values are: "Active" and - "Inactive". - :vartype status: str or ~azure.mgmt.containerregistry.models.ActivationStatus - """ - - _validation = { - "status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.ActivationStatus"]] = None - - -class Actor(_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: Any) -> None: - """ - :keyword name: The subject or username associated with the request context that generated the - event. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.system_data: Optional["_models.SystemData"] = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class AgentPool(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar 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. Known values are: "Windows" and "Linux". - :vartype os: str or ~azure.mgmt.containerregistry.models.OS - :ivar virtual_network_subnet_resource_id: The Virtual Network Subnet Resource Id of the agent - machine. - :vartype virtual_network_subnet_resource_id: str - :ivar provisioning_state: The provisioning state of this agent pool. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "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, - *, - location: str, - tags: Optional[dict[str, str]] = None, - count: Optional[int] = None, - tier: Optional[str] = None, - os: Optional[Union[str, "_models.OS"]] = None, - virtual_network_subnet_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :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. Known values are: "Windows" and "Linux". - :paramtype os: str or ~azure.mgmt.containerregistry.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().__init__(tags=tags, location=location, **kwargs) - self.count = count - self.tier = tier - self.os = os - self.virtual_network_subnet_resource_id = virtual_network_subnet_resource_id - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class AgentPoolListResult(_serialization.Model): - """The collection of agent pools. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[AgentPool]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.AgentPool"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.models.AgentPool] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AgentPoolQueueStatus(_serialization.Model): - """The QueueStatus of Agent Pool. - - :ivar count: The number of pending runs in the queue. - :vartype count: int - """ - - _attribute_map = { - "count": {"key": "count", "type": "int"}, - } - - def __init__(self, *, count: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword count: The number of pending runs in the queue. - :paramtype count: int - """ - super().__init__(**kwargs) - self.count = count - - -class AgentPoolUpdateParameters(_serialization.Model): - """The parameters for updating an agent pool. - - :ivar tags: The ARM resource tags. - :vartype tags: dict[str, str] - :ivar count: The count of agent machine. - :vartype count: int - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "count": {"key": "properties.count", "type": "int"}, - } - - def __init__(self, *, tags: Optional[dict[str, str]] = None, count: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword tags: The ARM resource tags. - :paramtype tags: dict[str, str] - :keyword count: The count of agent machine. - :paramtype count: int - """ - super().__init__(**kwargs) - self.tags = tags - self.count = count - - -class AgentProperties(_serialization.Model): - """The properties that determine the run agent configuration. - - :ivar cpu: The CPU configuration in terms of number of cores required for the run. - :vartype cpu: int - """ - - _attribute_map = { - "cpu": {"key": "cpu", "type": "int"}, - } - - def __init__(self, *, cpu: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword cpu: The CPU configuration in terms of number of cores required for the run. - :paramtype cpu: int - """ - super().__init__(**kwargs) - self.cpu = cpu - - -class Argument(_serialization.Model): - """The properties of a run argument. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the argument. Required. - :vartype name: str - :ivar value: The value of the argument. Required. - :vartype value: str - :ivar is_secret: Flag to indicate whether the argument represents a secret and want to be - removed from build logs. - :vartype 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, *, name: str, value: str, is_secret: bool = False, **kwargs: Any) -> None: - """ - :keyword name: The name of the argument. Required. - :paramtype name: str - :keyword value: The value of the argument. Required. - :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().__init__(**kwargs) - self.name = name - self.value = value - self.is_secret = is_secret - - -class AuthCredential(_serialization.Model): - """Authentication credential stored for an upstream. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. "Credential1" - :vartype name: str or ~azure.mgmt.containerregistry.models.CredentialName - :ivar username_secret_identifier: KeyVault Secret URI for accessing the username. - :vartype username_secret_identifier: str - :ivar password_secret_identifier: KeyVault Secret URI for accessing the password. - :vartype password_secret_identifier: str - :ivar credential_health: This provides data pertaining to the health of the auth credential. - :vartype credential_health: ~azure.mgmt.containerregistry.models.CredentialHealth - """ - - _validation = { - "credential_health": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "username_secret_identifier": {"key": "usernameSecretIdentifier", "type": "str"}, - "password_secret_identifier": {"key": "passwordSecretIdentifier", "type": "str"}, - "credential_health": {"key": "credentialHealth", "type": "CredentialHealth"}, - } - - def __init__( - self, - *, - name: Optional[Union[str, "_models.CredentialName"]] = None, - username_secret_identifier: Optional[str] = None, - password_secret_identifier: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the credential. "Credential1" - :paramtype name: str or ~azure.mgmt.containerregistry.models.CredentialName - :keyword username_secret_identifier: KeyVault Secret URI for accessing the username. - :paramtype username_secret_identifier: str - :keyword password_secret_identifier: KeyVault Secret URI for accessing the password. - :paramtype password_secret_identifier: str - """ - super().__init__(**kwargs) - self.name = name - self.username_secret_identifier = username_secret_identifier - self.password_secret_identifier = password_secret_identifier - self.credential_health: Optional["_models.CredentialHealth"] = None - - -class AuthInfo(_serialization.Model): - """The authorization properties for accessing the source code repository. - - All required parameters must be populated in order to send to server. - - :ivar token_type: The type of Auth token. Required. Known values are: "PAT" and "OAuth". - :vartype token_type: str or ~azure.mgmt.containerregistry.models.TokenType - :ivar token: The access token used to access the source control provider. Required. - :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 = { - "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, - *, - token_type: Union[str, "_models.TokenType"], - token: str, - refresh_token: Optional[str] = None, - scope: Optional[str] = None, - expires_in: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword token_type: The type of Auth token. Required. Known values are: "PAT" and "OAuth". - :paramtype token_type: str or ~azure.mgmt.containerregistry.models.TokenType - :keyword token: The access token used to access the source control provider. Required. - :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().__init__(**kwargs) - self.token_type = token_type - self.token = token - self.refresh_token = refresh_token - self.scope = scope - self.expires_in = expires_in - - -class AuthInfoUpdateParameters(_serialization.Model): - """The authorization properties for accessing the source code repository. - - :ivar token_type: The type of Auth token. Known values are: "PAT" and "OAuth". - :vartype token_type: str or ~azure.mgmt.containerregistry.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 = { - "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, - *, - token_type: Optional[Union[str, "_models.TokenType"]] = None, - token: Optional[str] = None, - refresh_token: Optional[str] = None, - scope: Optional[str] = None, - expires_in: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword token_type: The type of Auth token. Known values are: "PAT" and "OAuth". - :paramtype token_type: str or ~azure.mgmt.containerregistry.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().__init__(**kwargs) - self.token_type = token_type - self.token = token - self.refresh_token = refresh_token - self.scope = scope - self.expires_in = expires_in - - -class AzureADAuthenticationAsArmPolicy(_serialization.Model): - """The policy for using Azure Resource Manager audience token for a container registry. - - :ivar status: The value that indicates whether the policy is enabled or not. Known values are: - "enabled" and "disabled". - :vartype status: str or - ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicyStatus - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, *, status: Union[str, "_models.AzureADAuthenticationAsArmPolicyStatus"] = "enabled", **kwargs: Any - ) -> None: - """ - :keyword status: The value that indicates whether the policy is enabled or not. Known values - are: "enabled" and "disabled". - :paramtype status: str or - ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicyStatus - """ - super().__init__(**kwargs) - self.status = status - - -class BaseImageDependency(_serialization.Model): - """Properties that describe a base image dependency. - - :ivar type: The type of the base image dependency. Known values are: "BuildTime" and "RunTime". - :vartype type: str or ~azure.mgmt.containerregistry.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 = { - "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, - *, - type: Optional[Union[str, "_models.BaseImageDependencyType"]] = None, - registry: Optional[str] = None, - repository: Optional[str] = None, - tag: Optional[str] = None, - digest: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of the base image dependency. Known values are: "BuildTime" and - "RunTime". - :paramtype type: str or ~azure.mgmt.containerregistry.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().__init__(**kwargs) - self.type = type - self.registry = registry - self.repository = repository - self.tag = tag - self.digest = digest - - -class BaseImageTrigger(_serialization.Model): - """The trigger based on base image dependency. - - All required parameters must be populated in order to send to server. - - :ivar base_image_trigger_type: The type of the auto trigger for base image dependency updates. - Required. Known values are: "All" and "Runtime". - :vartype base_image_trigger_type: str or - ~azure.mgmt.containerregistry.models.BaseImageTriggerType - :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. Known - values are: "Default" and "Token". - :vartype update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.models.UpdateTriggerPayloadType - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, - *, - base_image_trigger_type: Union[str, "_models.BaseImageTriggerType"], - name: str, - update_trigger_endpoint: Optional[str] = None, - update_trigger_payload_type: Optional[Union[str, "_models.UpdateTriggerPayloadType"]] = None, - status: Optional[Union[str, "_models.TriggerStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword base_image_trigger_type: The type of the auto trigger for base image dependency - updates. Required. Known values are: "All" and "Runtime". - :paramtype base_image_trigger_type: str or - ~azure.mgmt.containerregistry.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. - Known values are: "Default" and "Token". - :paramtype update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.models.UpdateTriggerPayloadType - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.base_image_trigger_type = base_image_trigger_type - self.update_trigger_endpoint = update_trigger_endpoint - self.update_trigger_payload_type = update_trigger_payload_type - self.status = status - self.name = name - - -class BaseImageTriggerUpdateParameters(_serialization.Model): - """The properties for updating base image dependency trigger. - - All required parameters must be populated in order to send to server. - - :ivar base_image_trigger_type: The type of the auto trigger for base image dependency updates. - Known values are: "All" and "Runtime". - :vartype base_image_trigger_type: str or - ~azure.mgmt.containerregistry.models.BaseImageTriggerType - :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. Known - values are: "Default" and "Token". - :vartype update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.models.UpdateTriggerPayloadType - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, - *, - name: str, - base_image_trigger_type: Optional[Union[str, "_models.BaseImageTriggerType"]] = None, - update_trigger_endpoint: Optional[str] = None, - update_trigger_payload_type: Optional[Union[str, "_models.UpdateTriggerPayloadType"]] = None, - status: Optional[Union[str, "_models.TriggerStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword base_image_trigger_type: The type of the auto trigger for base image dependency - updates. Known values are: "All" and "Runtime". - :paramtype base_image_trigger_type: str or - ~azure.mgmt.containerregistry.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. - Known values are: "Default" and "Token". - :paramtype update_trigger_payload_type: str or - ~azure.mgmt.containerregistry.models.UpdateTriggerPayloadType - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.base_image_trigger_type = base_image_trigger_type - self.update_trigger_endpoint = update_trigger_endpoint - self.update_trigger_payload_type = update_trigger_payload_type - self.status = status - self.name = name - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - """ - - -class CacheRule(ProxyResource): - """An object that represents a cache rule for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar credential_set_resource_id: The ARM resource ID of the credential store which is - associated with the cache rule. - :vartype credential_set_resource_id: str - :ivar source_repository: Source repository pulled from upstream. - :vartype source_repository: str - :ivar target_repository: Target repository specified in docker pull command. - Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag}. - :vartype target_repository: str - :ivar creation_date: The creation date of the cache rule. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - """ - - _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"}, - "credential_set_resource_id": {"key": "properties.credentialSetResourceId", "type": "str"}, - "source_repository": {"key": "properties.sourceRepository", "type": "str"}, - "target_repository": {"key": "properties.targetRepository", "type": "str"}, - "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - credential_set_resource_id: Optional[str] = None, - source_repository: Optional[str] = None, - target_repository: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword credential_set_resource_id: The ARM resource ID of the credential store which is - associated with the cache rule. - :paramtype credential_set_resource_id: str - :keyword source_repository: Source repository pulled from upstream. - :paramtype source_repository: str - :keyword target_repository: Target repository specified in docker pull command. - Eg: docker pull myregistry.azurecr.io/{targetRepository}:{tag}. - :paramtype target_repository: str - """ - super().__init__(**kwargs) - self.credential_set_resource_id = credential_set_resource_id - self.source_repository = source_repository - self.target_repository = target_repository - self.creation_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class CacheRulesListResult(_serialization.Model): - """The result of a request to list cache rules for a container registry. - - :ivar value: The list of cache rules. Since this list may be incomplete, the nextLink field - should be used to request the next list of cache rules. - :vartype value: list[~azure.mgmt.containerregistry.models.CacheRule] - :ivar next_link: The URI that can be used to request the next list of cache rules. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CacheRule]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.CacheRule"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of cache rules. Since this list may be incomplete, the nextLink field - should be used to request the next list of cache rules. - :paramtype value: list[~azure.mgmt.containerregistry.models.CacheRule] - :keyword next_link: The URI that can be used to request the next list of cache rules. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CacheRuleUpdateParameters(_serialization.Model): - """The parameters for updating a cache rule. - - :ivar credential_set_resource_id: The ARM resource ID of the credential store which is - associated with the Cache rule. - :vartype credential_set_resource_id: str - """ - - _attribute_map = { - "credential_set_resource_id": {"key": "properties.credentialSetResourceId", "type": "str"}, - } - - def __init__(self, *, credential_set_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword credential_set_resource_id: The ARM resource ID of the credential store which is - associated with the Cache rule. - :paramtype credential_set_resource_id: str - """ - super().__init__(**kwargs) - self.credential_set_resource_id = credential_set_resource_id - - -class CallbackConfig(_serialization.Model): - """The configuration of service URI and custom headers for the webhook. - - All required parameters must be populated in order to send to server. - - :ivar service_uri: The service URI for the webhook to post notifications. Required. - :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: Any) -> None: - """ - :keyword service_uri: The service URI for the webhook to post notifications. Required. - :paramtype service_uri: str - :keyword custom_headers: Custom headers that will be added to the webhook notifications. - :paramtype custom_headers: dict[str, str] - """ - super().__init__(**kwargs) - self.service_uri = service_uri - self.custom_headers = custom_headers - - -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: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar mode: The mode of the connected registry resource that indicates the permissions of the - registry. Known values are: "ReadWrite", "ReadOnly", "Registry", and "Mirror". - :vartype mode: str or ~azure.mgmt.containerregistry.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. Known values - are: "Online", "Offline", "Syncing", and "Unhealthy". - :vartype connection_state: str or ~azure.mgmt.containerregistry.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.models.ActivationProperties - :ivar parent: The parent of the connected registry. - :vartype parent: ~azure.mgmt.containerregistry.models.ParentProperties - :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :vartype client_token_ids: list[str] - :ivar login_server: The login server properties of the connected registry. - :vartype login_server: ~azure.mgmt.containerregistry.models.LoginServerProperties - :ivar logging: The logging properties of the connected registry. - :vartype logging: ~azure.mgmt.containerregistry.models.LoggingProperties - :ivar status_details: The list of current statuses of the connected registry. - :vartype status_details: list[~azure.mgmt.containerregistry.models.StatusDetailProperties] - :ivar notifications_list: The list of notifications subscription information for the connected - registry. - :vartype notifications_list: list[str] - :ivar garbage_collection: The garbage collection properties of the connected registry. - :vartype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties - """ - - _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]"}, - "garbage_collection": {"key": "properties.garbageCollection", "type": "GarbageCollectionProperties"}, - } - - def __init__( - self, - *, - mode: Optional[Union[str, "_models.ConnectedRegistryMode"]] = None, - parent: Optional["_models.ParentProperties"] = None, - client_token_ids: Optional[list[str]] = None, - login_server: Optional["_models.LoginServerProperties"] = None, - logging: Optional["_models.LoggingProperties"] = None, - notifications_list: Optional[list[str]] = None, - garbage_collection: Optional["_models.GarbageCollectionProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword mode: The mode of the connected registry resource that indicates the permissions of - the registry. Known values are: "ReadWrite", "ReadOnly", "Registry", and "Mirror". - :paramtype mode: str or ~azure.mgmt.containerregistry.models.ConnectedRegistryMode - :keyword parent: The parent of the connected registry. - :paramtype parent: ~azure.mgmt.containerregistry.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.models.LoginServerProperties - :keyword logging: The logging properties of the connected registry. - :paramtype logging: ~azure.mgmt.containerregistry.models.LoggingProperties - :keyword notifications_list: The list of notifications subscription information for the - connected registry. - :paramtype notifications_list: list[str] - :keyword garbage_collection: The garbage collection properties of the connected registry. - :paramtype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties - """ - super().__init__(**kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.mode = mode - self.version: Optional[str] = None - self.connection_state: Optional[Union[str, "_models.ConnectionState"]] = None - self.last_activity_time: Optional[datetime.datetime] = None - self.activation: Optional["_models.ActivationProperties"] = None - self.parent = parent - self.client_token_ids = client_token_ids - self.login_server = login_server - self.logging = logging - self.status_details: Optional[list["_models.StatusDetailProperties"]] = None - self.notifications_list = notifications_list - self.garbage_collection = garbage_collection - - -class ConnectedRegistryListResult(_serialization.Model): - """The result of a request to list connected registries for a container registry. - - :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. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[ConnectedRegistry]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[list["_models.ConnectedRegistry"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ConnectedRegistry] - :keyword next_link: The URI that can be used to request the next list of connected registries. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ConnectedRegistryUpdateParameters(_serialization.Model): - """The parameters for updating a connected registry. - - :ivar sync_properties: The sync properties of the connected registry with its parent. - :vartype sync_properties: ~azure.mgmt.containerregistry.models.SyncUpdateProperties - :ivar logging: The logging properties of the connected registry. - :vartype logging: ~azure.mgmt.containerregistry.models.LoggingProperties - :ivar client_token_ids: The list of the ACR token resource IDs used to authenticate clients to - the connected registry. - :vartype client_token_ids: list[str] - :ivar notifications_list: The list of notifications subscription information for the connected - registry. - :vartype notifications_list: list[str] - :ivar garbage_collection: The garbage collection properties of the connected registry. - :vartype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties - """ - - _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]"}, - "garbage_collection": {"key": "properties.garbageCollection", "type": "GarbageCollectionProperties"}, - } - - def __init__( - self, - *, - sync_properties: Optional["_models.SyncUpdateProperties"] = None, - logging: Optional["_models.LoggingProperties"] = None, - client_token_ids: Optional[list[str]] = None, - notifications_list: Optional[list[str]] = None, - garbage_collection: Optional["_models.GarbageCollectionProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword sync_properties: The sync properties of the connected registry with its parent. - :paramtype sync_properties: ~azure.mgmt.containerregistry.models.SyncUpdateProperties - :keyword logging: The logging properties of the connected registry. - :paramtype logging: ~azure.mgmt.containerregistry.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] - :keyword garbage_collection: The garbage collection properties of the connected registry. - :paramtype garbage_collection: ~azure.mgmt.containerregistry.models.GarbageCollectionProperties - """ - super().__init__(**kwargs) - self.sync_properties = sync_properties - self.logging = logging - self.client_token_ids = client_token_ids - self.notifications_list = notifications_list - self.garbage_collection = garbage_collection - - -class CredentialHealth(_serialization.Model): - """The health of the auth credential. - - :ivar status: The health status of credential. Known values are: "Healthy" and "Unhealthy". - :vartype status: str or ~azure.mgmt.containerregistry.models.CredentialHealthStatus - :ivar error_code: Error code representing the health check error. - :vartype error_code: str - :ivar error_message: Descriptive message representing the health check error. - :vartype error_message: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "error_code": {"key": "errorCode", "type": "str"}, - "error_message": {"key": "errorMessage", "type": "str"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.CredentialHealthStatus"]] = None, - error_code: Optional[str] = None, - error_message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The health status of credential. Known values are: "Healthy" and "Unhealthy". - :paramtype status: str or ~azure.mgmt.containerregistry.models.CredentialHealthStatus - :keyword error_code: Error code representing the health check error. - :paramtype error_code: str - :keyword error_message: Descriptive message representing the health check error. - :paramtype error_message: str - """ - super().__init__(**kwargs) - self.status = status - self.error_code = error_code - self.error_message = error_message - - -class Credentials(_serialization.Model): - """The parameters that describes a set of credentials that will be used when a run is invoked. - - :ivar source_registry: Describes the credential parameters for accessing the source registry. - :vartype source_registry: ~azure.mgmt.containerregistry.models.SourceRegistryCredentials - :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. - :vartype custom_registries: dict[str, - ~azure.mgmt.containerregistry.models.CustomRegistryCredentials] - """ - - _attribute_map = { - "source_registry": {"key": "sourceRegistry", "type": "SourceRegistryCredentials"}, - "custom_registries": {"key": "customRegistries", "type": "{CustomRegistryCredentials}"}, - } - - def __init__( - self, - *, - source_registry: Optional["_models.SourceRegistryCredentials"] = None, - custom_registries: Optional[dict[str, "_models.CustomRegistryCredentials"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_registry: Describes the credential parameters for accessing the source - registry. - :paramtype source_registry: ~azure.mgmt.containerregistry.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.models.CustomRegistryCredentials] - """ - super().__init__(**kwargs) - self.source_registry = source_registry - self.custom_registries = custom_registries - - -class CredentialSet(ProxyResource): - """An object that represents a credential set resource for a container registry. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar identity: Identities associated with the resource. This is used to access the KeyVault - secrets. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar login_server: The credentials are stored for this upstream or login server. - :vartype login_server: str - :ivar auth_credentials: List of authentication credentials stored for an upstream. - Usually consists of a primary and an optional secondary credential. - :vartype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] - :ivar creation_date: The creation date of credential store resource. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - """ - - _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"}, - "identity": {"key": "identity", "type": "IdentityProperties"}, - "login_server": {"key": "properties.loginServer", "type": "str"}, - "auth_credentials": {"key": "properties.authCredentials", "type": "[AuthCredential]"}, - "creation_date": {"key": "properties.creationDate", "type": "iso-8601"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - identity: Optional["_models.IdentityProperties"] = None, - login_server: Optional[str] = None, - auth_credentials: Optional[list["_models.AuthCredential"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identities associated with the resource. This is used to access the KeyVault - secrets. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword login_server: The credentials are stored for this upstream or login server. - :paramtype login_server: str - :keyword auth_credentials: List of authentication credentials stored for an upstream. - Usually consists of a primary and an optional secondary credential. - :paramtype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] - """ - super().__init__(**kwargs) - self.identity = identity - self.login_server = login_server - self.auth_credentials = auth_credentials - self.creation_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class CredentialSetListResult(_serialization.Model): - """The result of a request to list credential sets for a container registry. - - :ivar value: The list of credential sets. Since this list may be incomplete, the nextLink field - should be used to request the next list of credential sets. - :vartype value: list[~azure.mgmt.containerregistry.models.CredentialSet] - :ivar next_link: The URI that can be used to request the next list of credential sets. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[CredentialSet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.CredentialSet"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of credential sets. Since this list may be incomplete, the nextLink - field should be used to request the next list of credential sets. - :paramtype value: list[~azure.mgmt.containerregistry.models.CredentialSet] - :keyword next_link: The URI that can be used to request the next list of credential sets. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class CredentialSetUpdateParameters(_serialization.Model): - """The parameters for updating a credential set. - - :ivar identity: Identities associated with the resource. This is used to access the KeyVault - secrets. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar auth_credentials: List of authentication credentials stored for an upstream. - Usually consists of a primary and an optional secondary credential. - :vartype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "IdentityProperties"}, - "auth_credentials": {"key": "properties.authCredentials", "type": "[AuthCredential]"}, - } - - def __init__( - self, - *, - identity: Optional["_models.IdentityProperties"] = None, - auth_credentials: Optional[list["_models.AuthCredential"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identities associated with the resource. This is used to access the KeyVault - secrets. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword auth_credentials: List of authentication credentials stored for an upstream. - Usually consists of a primary and an optional secondary credential. - :paramtype auth_credentials: list[~azure.mgmt.containerregistry.models.AuthCredential] - """ - super().__init__(**kwargs) - self.identity = identity - self.auth_credentials = auth_credentials - - -class CustomRegistryCredentials(_serialization.Model): - """Describes the credentials that will be used to access a custom registry during a run. - - :ivar user_name: The username for logging into the custom registry. - :vartype user_name: ~azure.mgmt.containerregistry.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. - :vartype password: ~azure.mgmt.containerregistry.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. - :vartype identity: str - """ - - _attribute_map = { - "user_name": {"key": "userName", "type": "SecretObject"}, - "password": {"key": "password", "type": "SecretObject"}, - "identity": {"key": "identity", "type": "str"}, - } - - def __init__( - self, - *, - user_name: Optional["_models.SecretObject"] = None, - password: Optional["_models.SecretObject"] = None, - identity: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword user_name: The username for logging into the custom registry. - :paramtype user_name: ~azure.mgmt.containerregistry.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.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().__init__(**kwargs) - self.user_name = user_name - self.password = password - self.identity = identity - - -class RunRequest(_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 server. - - :ivar type: The type of the run request. Required. - :vartype type: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :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. - :vartype 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, - *, - is_archive_enabled: bool = False, - agent_pool_name: Optional[str] = None, - log_template: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.type: Optional[str] = None - self.is_archive_enabled = is_archive_enabled - self.agent_pool_name = agent_pool_name - self.log_template = log_template - - -class DockerBuildRequest(RunRequest): - """The parameters for a docker quick build. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the run request. Required. - :vartype type: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :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. - :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. - :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 location. Required. - :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.models.Argument] - :ivar timeout: Run timeout in seconds. - :vartype timeout: int - :ivar platform: The platform properties against which the run has to happen. Required. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.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. - :vartype source_location: str - :ivar credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :vartype credentials: ~azure.mgmt.containerregistry.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, - *, - docker_file_path: str, - platform: "_models.PlatformProperties", - is_archive_enabled: bool = False, - agent_pool_name: Optional[str] = None, - log_template: Optional[str] = None, - image_names: Optional[list[str]] = None, - is_push_enabled: bool = True, - no_cache: bool = False, - target: Optional[str] = None, - arguments: Optional[list["_models.Argument"]] = None, - timeout: int = 3600, - agent_configuration: Optional["_models.AgentProperties"] = None, - source_location: Optional[str] = None, - credentials: Optional["_models.Credentials"] = None, - **kwargs: Any - ) -> None: - """ - :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: The Docker file path relative to the source location. Required. - :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.models.Argument] - :keyword timeout: Run timeout in seconds. - :paramtype timeout: int - :keyword platform: The platform properties against which the run has to happen. Required. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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.models.Credentials - """ - super().__init__( - is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs - ) - self.type: str = "DockerBuildRequest" - self.image_names = image_names - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.docker_file_path = docker_file_path - self.target = target - self.arguments = arguments - self.timeout = timeout - self.platform = platform - self.agent_configuration = agent_configuration - self.source_location = source_location - self.credentials = credentials - - -class TaskStepProperties(_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 server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.models.BaseImageDependency] - :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 = { - "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, *, context_path: Optional[str] = None, context_access_token: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.type: Optional[str] = None - self.base_image_dependencies: Optional[list["_models.BaseImageDependency"]] = None - self.context_path = context_path - self.context_access_token = context_access_token - - -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 server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.models.BaseImageDependency] - :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. - :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. Required. - :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. - :vartype arguments: list[~azure.mgmt.containerregistry.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, - *, - docker_file_path: str, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - image_names: Optional[list[str]] = None, - is_push_enabled: bool = True, - no_cache: bool = False, - target: Optional[str] = None, - arguments: Optional[list["_models.Argument"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Required. - :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.models.Argument] - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "Docker" - self.image_names = image_names - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.docker_file_path = docker_file_path - self.target = target - self.arguments = arguments - - -class TaskStepUpdateParameters(_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 server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.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 = { - "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, *, context_path: Optional[str] = None, context_access_token: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.type: Optional[str] = None - self.context_path = context_path - self.context_access_token = context_access_token - - -class DockerBuildStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating a docker build step. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.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. - :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. - :vartype arguments: list[~azure.mgmt.containerregistry.models.Argument] - :ivar target: The name of the target build stage for the docker build. - :vartype 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, - *, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - image_names: Optional[list[str]] = None, - is_push_enabled: Optional[bool] = None, - no_cache: Optional[bool] = None, - docker_file_path: Optional[str] = None, - arguments: Optional[list["_models.Argument"]] = None, - target: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.models.Argument] - :keyword target: The name of the target build stage for the docker build. - :paramtype target: str - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "Docker" - self.image_names = image_names - self.is_push_enabled = is_push_enabled - self.no_cache = no_cache - self.docker_file_path = docker_file_path - self.arguments = arguments - self.target = target - - -class EncodedTaskRunRequest(RunRequest): - """The parameters for a quick task run request. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the run request. Required. - :vartype type: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :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. - :vartype log_template: str - :ivar encoded_task_content: Base64 encoded value of the template/definition file content. - Required. - :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.models.SetValue] - :ivar timeout: Run timeout in seconds. - :vartype timeout: int - :ivar platform: The platform properties against which the run has to happen. Required. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.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. - :vartype source_location: str - :ivar credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :vartype credentials: ~azure.mgmt.containerregistry.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, - *, - encoded_task_content: str, - platform: "_models.PlatformProperties", - is_archive_enabled: bool = False, - agent_pool_name: Optional[str] = None, - log_template: Optional[str] = None, - encoded_values_content: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - timeout: int = 3600, - agent_configuration: Optional["_models.AgentProperties"] = None, - source_location: Optional[str] = None, - credentials: Optional["_models.Credentials"] = None, - **kwargs: Any - ) -> None: - """ - :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: Base64 encoded value of the template/definition file content. - Required. - :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.models.SetValue] - :keyword timeout: Run timeout in seconds. - :paramtype timeout: int - :keyword platform: The platform properties against which the run has to happen. Required. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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.models.Credentials - """ - super().__init__( - is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs - ) - self.type: str = "EncodedTaskRunRequest" - self.encoded_task_content = encoded_task_content - self.encoded_values_content = encoded_values_content - self.values = values - self.timeout = timeout - self.platform = platform - self.agent_configuration = agent_configuration - self.source_location = source_location - self.credentials = credentials - - -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 server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.models.BaseImageDependency] - :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. - Required. - :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.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, - *, - encoded_task_content: str, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - encoded_values_content: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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. - Required. - :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.models.SetValue] - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "EncodedTask" - self.encoded_task_content = encoded_task_content - self.encoded_values_content = encoded_values_content - self.values = values - - -class EncodedTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties for updating encoded task step. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.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.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, - *, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - encoded_task_content: Optional[str] = None, - encoded_values_content: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.SetValue] - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "EncodedTask" - self.encoded_task_content = encoded_task_content - self.encoded_values_content = encoded_values_content - self.values = values - - -class EncryptionProperty(_serialization.Model): - """EncryptionProperty. - - :ivar status: Indicates whether or not the encryption is enabled for container registry. Known - values are: "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.EncryptionStatus - :ivar key_vault_properties: Key vault properties. - :vartype key_vault_properties: ~azure.mgmt.containerregistry.models.KeyVaultProperties - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "key_vault_properties": {"key": "keyVaultProperties", "type": "KeyVaultProperties"}, - } - - def __init__( - self, - *, - status: Optional[Union[str, "_models.EncryptionStatus"]] = None, - key_vault_properties: Optional["_models.KeyVaultProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: Indicates whether or not the encryption is enabled for container registry. - Known values are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.EncryptionStatus - :keyword key_vault_properties: Key vault properties. - :paramtype key_vault_properties: ~azure.mgmt.containerregistry.models.KeyVaultProperties - """ - super().__init__(**kwargs) - self.status = status - self.key_vault_properties = key_vault_properties - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.info: Optional[JSON] = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.containerregistry.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.containerregistry.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code: Optional[str] = None - self.message: Optional[str] = None - self.target: Optional[str] = None - self.details: Optional[list["_models.ErrorDetail"]] = None - self.additional_info: Optional[list["_models.ErrorAdditionalInfo"]] = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerregistry.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerregistry.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class EventInfo(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: The event ID. - :paramtype id: str - """ - super().__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.models.EventRequestMessage - :ivar event_response_message: The event response message received from the service URI. - :vartype event_response_message: ~azure.mgmt.containerregistry.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, # pylint: disable=redefined-builtin - event_request_message: Optional["_models.EventRequestMessage"] = None, - event_response_message: Optional["_models.EventResponseMessage"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.EventRequestMessage - :keyword event_response_message: The event response message received from the service URI. - :paramtype event_response_message: ~azure.mgmt.containerregistry.models.EventResponseMessage - """ - super().__init__(id=id, **kwargs) - self.event_request_message = event_request_message - self.event_response_message = event_response_message - - -class EventContent(_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.models.Target - :ivar request: The request that generated the event. - :vartype request: ~azure.mgmt.containerregistry.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.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.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, # pylint: disable=redefined-builtin - timestamp: Optional[datetime.datetime] = None, - action: Optional[str] = None, - target: Optional["_models.Target"] = None, - request: Optional["_models.Request"] = None, - actor: Optional["_models.Actor"] = None, - source: Optional["_models.Source"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.Target - :keyword request: The request that generated the event. - :paramtype request: ~azure.mgmt.containerregistry.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.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.models.Source - """ - super().__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(_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.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["_models.Event"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.Event] - :keyword next_link: The URI that can be used to request the next list of events. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class EventRequestMessage(_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.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["_models.EventContent"] = None, - headers: Optional[dict[str, str]] = None, - method: Optional[str] = None, - request_uri: Optional[str] = None, - version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword content: The content of the event request message. - :paramtype content: ~azure.mgmt.containerregistry.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().__init__(**kwargs) - self.content = content - self.headers = headers - self.method = method - self.request_uri = request_uri - self.version = version - - -class EventResponseMessage(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.content = content - self.headers = headers - self.reason_phrase = reason_phrase - self.status_code = status_code - self.version = version - - -class ExportPolicy(_serialization.Model): - """The export policy for a container registry. - - :ivar status: The value that indicates whether the policy is enabled or not. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.ExportPolicyStatus - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Union[str, "_models.ExportPolicyStatus"] = "enabled", **kwargs: Any) -> None: - """ - :keyword status: The value that indicates whether the policy is enabled or not. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.ExportPolicyStatus - """ - super().__init__(**kwargs) - self.status = status - - -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 server. - - :ivar type: The type of the run request. Required. - :vartype type: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :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. - :vartype log_template: str - :ivar task_file_path: The template/definition file path relative to the source. Required. - :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.models.SetValue] - :ivar timeout: Run timeout in seconds. - :vartype timeout: int - :ivar platform: The platform properties against which the run has to happen. Required. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.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. - :vartype source_location: str - :ivar credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :vartype credentials: ~azure.mgmt.containerregistry.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, - *, - task_file_path: str, - platform: "_models.PlatformProperties", - is_archive_enabled: bool = False, - agent_pool_name: Optional[str] = None, - log_template: Optional[str] = None, - values_file_path: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - timeout: int = 3600, - agent_configuration: Optional["_models.AgentProperties"] = None, - source_location: Optional[str] = None, - credentials: Optional["_models.Credentials"] = None, - **kwargs: Any - ) -> None: - """ - :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: The template/definition file path relative to the source. Required. - :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.models.SetValue] - :keyword timeout: Run timeout in seconds. - :paramtype timeout: int - :keyword platform: The platform properties against which the run has to happen. Required. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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.models.Credentials - """ - super().__init__( - is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs - ) - self.type: str = "FileTaskRunRequest" - self.task_file_path = task_file_path - self.values_file_path = values_file_path - self.values = values - self.timeout = timeout - self.platform = platform - self.agent_configuration = agent_configuration - self.source_location = source_location - self.credentials = credentials - - -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 server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.models.StepType - :ivar base_image_dependencies: List of base image dependencies for a step. - :vartype base_image_dependencies: - list[~azure.mgmt.containerregistry.models.BaseImageDependency] - :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. - Required. - :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.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, - *, - task_file_path: str, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - values_file_path: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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. - Required. - :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.models.SetValue] - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "FileTask" - self.task_file_path = task_file_path - self.values_file_path = values_file_path - self.values = values - - -class FileTaskStepUpdateParameters(TaskStepUpdateParameters): - """The properties of updating a task step. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the step. Required. Known values are: "Docker", "FileTask", and - "EncodedTask". - :vartype type: str or ~azure.mgmt.containerregistry.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.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, - *, - context_path: Optional[str] = None, - context_access_token: Optional[str] = None, - task_file_path: Optional[str] = None, - values_file_path: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.SetValue] - """ - super().__init__(context_path=context_path, context_access_token=context_access_token, **kwargs) - self.type: str = "FileTask" - self.task_file_path = task_file_path - self.values_file_path = values_file_path - self.values = values - - -class GarbageCollectionProperties(_serialization.Model): - """The garbage collection properties of the connected registry. - - :ivar enabled: Indicates whether garbage collection is enabled for the connected registry. - :vartype enabled: bool - :ivar schedule: The cron expression indicating the schedule that the connected registry will - run garbage collection. - :vartype schedule: str - """ - - _attribute_map = { - "enabled": {"key": "enabled", "type": "bool"}, - "schedule": {"key": "schedule", "type": "str"}, - } - - def __init__(self, *, enabled: Optional[bool] = None, schedule: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword enabled: Indicates whether garbage collection is enabled for the connected registry. - :paramtype enabled: bool - :keyword schedule: The cron expression indicating the schedule that the connected registry will - run garbage collection. - :paramtype schedule: str - """ - super().__init__(**kwargs) - self.enabled = enabled - self.schedule = schedule - - -class GenerateCredentialsParameters(_serialization.Model): - """The parameters used to generate credentials for a specified token or user of a container - registry. - - :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. - :vartype expiry: ~datetime.datetime - :ivar name: Specifies name of the password which should be regenerated if any -- password1 or - password2. Known values are: "password1" and "password2". - :vartype name: str or ~azure.mgmt.containerregistry.models.TokenPasswordName - """ - - _attribute_map = { - "token_id": {"key": "tokenId", "type": "str"}, - "expiry": {"key": "expiry", "type": "iso-8601"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - token_id: Optional[str] = None, - expiry: Optional[datetime.datetime] = None, - name: Optional[Union[str, "_models.TokenPasswordName"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: "password1" and "password2". - :paramtype name: str or ~azure.mgmt.containerregistry.models.TokenPasswordName - """ - super().__init__(**kwargs) - self.token_id = token_id - self.expiry = expiry - self.name = name - - -class GenerateCredentialsResult(_serialization.Model): - """The response from the GenerateCredentials 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.models.TokenPassword] - """ - - _attribute_map = { - "username": {"key": "username", "type": "str"}, - "passwords": {"key": "passwords", "type": "[TokenPassword]"}, - } - - def __init__( - self, - *, - username: Optional[str] = None, - passwords: Optional[list["_models.TokenPassword"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.TokenPassword] - """ - super().__init__(**kwargs) - self.username = username - self.passwords = passwords - - -class IdentityProperties(_serialization.Model): - """Managed identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of resource identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of resource. - :vartype tenant_id: str - :ivar type: The identity type. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :vartype type: str or ~azure.mgmt.containerregistry.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.models.UserIdentityProperties] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserIdentityProperties}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, - user_assigned_identities: Optional[dict[str, "_models.UserIdentityProperties"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned", - "SystemAssigned, UserAssigned", and "None". - :paramtype type: str or ~azure.mgmt.containerregistry.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.models.UserIdentityProperties] - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class ImageDescriptor(_serialization.Model): - """Properties for a registry image. - - :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 = { - "registry": {"key": "registry", "type": "str"}, - "repository": {"key": "repository", "type": "str"}, - "tag": {"key": "tag", "type": "str"}, - "digest": {"key": "digest", "type": "str"}, - } - - def __init__( - self, - *, - registry: Optional[str] = None, - repository: Optional[str] = None, - tag: Optional[str] = None, - digest: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.registry = registry - self.repository = repository - self.tag = tag - self.digest = digest - - -class ImageUpdateTrigger(_serialization.Model): - """The image update trigger that caused a build. - - :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.models.ImageDescriptor] - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "timestamp": {"key": "timestamp", "type": "iso-8601"}, - "images": {"key": "images", "type": "[ImageDescriptor]"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - timestamp: Optional[datetime.datetime] = None, - images: Optional[list["_models.ImageDescriptor"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ImageDescriptor] - """ - super().__init__(**kwargs) - self.id = id - self.timestamp = timestamp - self.images = images - - -class ImportImageParameters(_serialization.Model): - """ImportImageParameters. - - All required parameters must be populated in order to send to server. - - :ivar source: The source of the image. Required. - :vartype source: ~azure.mgmt.containerregistry.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. Known values are: - "NoForce" and "Force". - :vartype mode: str or ~azure.mgmt.containerregistry.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: "_models.ImportSource", - target_tags: Optional[list[str]] = None, - untagged_target_repositories: Optional[list[str]] = None, - mode: Union[str, "_models.ImportMode"] = "NoForce", - **kwargs: Any - ) -> None: - """ - :keyword source: The source of the image. Required. - :paramtype source: ~azure.mgmt.containerregistry.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. Known values are: - "NoForce" and "Force". - :paramtype mode: str or ~azure.mgmt.containerregistry.models.ImportMode - """ - super().__init__(**kwargs) - self.source = source - self.target_tags = target_tags - self.untagged_target_repositories = untagged_target_repositories - self.mode = mode - - -class ImportSource(_serialization.Model): - """ImportSource. - - All required parameters must be populated in order to send to server. - - :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.models.ImportSourceCredentials - :ivar source_image: 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'). Required. - :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["_models.ImportSourceCredentials"] = None, - **kwargs: Any - ) -> None: - """ - :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.models.ImportSourceCredentials - :keyword source_image: 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'). Required. - :paramtype source_image: str - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.registry_uri = registry_uri - self.credentials = credentials - self.source_image = source_image - - -class ImportSourceCredentials(_serialization.Model): - """ImportSourceCredentials. - - All required parameters must be populated in order to send to server. - - :ivar username: The username to authenticate with the source registry. - :vartype username: str - :ivar password: The password used to authenticate with the source registry. Required. - :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: Any) -> None: - """ - :keyword username: The username to authenticate with the source registry. - :paramtype username: str - :keyword password: The password used to authenticate with the source registry. Required. - :paramtype password: str - """ - super().__init__(**kwargs) - self.username = username - self.password = password - - -class IPRule(_serialization.Model): - """IP rule with specific IP or IP range in CIDR format. - - All required parameters must be populated in order to send to server. - - :ivar action: The action of IP ACL rule. "Allow" - :vartype action: str or ~azure.mgmt.containerregistry.models.Action - :ivar ip_address_or_range: Specifies the IP or IP range in CIDR format. Only IPV4 address is - allowed. Required. - :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: Union[str, "_models.Action"] = "Allow", **kwargs: Any - ) -> None: - """ - :keyword action: The action of IP ACL rule. "Allow" - :paramtype action: str or ~azure.mgmt.containerregistry.models.Action - :keyword ip_address_or_range: Specifies the IP or IP range in CIDR format. Only IPV4 address is - allowed. Required. - :paramtype ip_address_or_range: str - """ - super().__init__(**kwargs) - self.action = action - self.ip_address_or_range = ip_address_or_range - - -class KeyVaultProperties(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.key_identifier = key_identifier - self.versioned_key_identifier: Optional[str] = None - self.identity = identity - self.key_rotation_enabled: Optional[bool] = None - self.last_key_rotation_timestamp: Optional[datetime.datetime] = None - - -class LoggingProperties(_serialization.Model): - """The logging properties of the connected registry. - - :ivar log_level: The verbosity of logs persisted on the connected registry. Known values are: - "Debug", "Information", "Warning", "Error", and "None". - :vartype log_level: str or ~azure.mgmt.containerregistry.models.LogLevel - :ivar audit_log_status: Indicates whether audit logs are enabled on the connected registry. - Known values are: "Enabled" and "Disabled". - :vartype audit_log_status: str or ~azure.mgmt.containerregistry.models.AuditLogStatus - """ - - _attribute_map = { - "log_level": {"key": "logLevel", "type": "str"}, - "audit_log_status": {"key": "auditLogStatus", "type": "str"}, - } - - def __init__( - self, - *, - log_level: Union[str, "_models.LogLevel"] = "Information", - audit_log_status: Union[str, "_models.AuditLogStatus"] = "Disabled", - **kwargs: Any - ) -> None: - """ - :keyword log_level: The verbosity of logs persisted on the connected registry. Known values - are: "Debug", "Information", "Warning", "Error", and "None". - :paramtype log_level: str or ~azure.mgmt.containerregistry.models.LogLevel - :keyword audit_log_status: Indicates whether audit logs are enabled on the connected registry. - Known values are: "Enabled" and "Disabled". - :paramtype audit_log_status: str or ~azure.mgmt.containerregistry.models.AuditLogStatus - """ - super().__init__(**kwargs) - self.log_level = log_level - self.audit_log_status = audit_log_status - - -class LoginServerProperties(_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.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.host: Optional[str] = None - self.tls: Optional["_models.TlsProperties"] = None - - -class NetworkRuleSet(_serialization.Model): - """The network rule set for a container registry. - - All required parameters must be populated in order to send to server. - - :ivar default_action: The default action of allow or deny when no other rules match. Known - values are: "Allow" and "Deny". - :vartype default_action: str or ~azure.mgmt.containerregistry.models.DefaultAction - :ivar ip_rules: The IP ACL rules. - :vartype ip_rules: list[~azure.mgmt.containerregistry.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, "_models.DefaultAction"] = "Allow", - ip_rules: Optional[list["_models.IPRule"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword default_action: The default action of allow or deny when no other rules match. Known - values are: "Allow" and "Deny". - :paramtype default_action: str or ~azure.mgmt.containerregistry.models.DefaultAction - :keyword ip_rules: The IP ACL rules. - :paramtype ip_rules: list[~azure.mgmt.containerregistry.models.IPRule] - """ - super().__init__(**kwargs) - self.default_action = default_action - self.ip_rules = ip_rules - - -class OperationDefinition(_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.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.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["_models.OperationDisplayDefinition"] = None, - is_data_action: Optional[bool] = None, - service_specification: Optional["_models.OperationServiceSpecificationDefinition"] = None, - **kwargs: Any - ) -> None: - """ - :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.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.models.OperationServiceSpecificationDefinition - """ - super().__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(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class OperationListResult(_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.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["_models.OperationDefinition"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class OperationLogSpecificationDefinition(_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: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.name = name - self.display_name = display_name - self.blob_duration = blob_duration - - -class OperationMetricSpecificationDefinition(_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: Any - ) -> None: - """ - :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().__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(_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.models.OperationMetricSpecificationDefinition] - :ivar log_specifications: A list of Azure Monitoring log definitions. - :vartype log_specifications: - list[~azure.mgmt.containerregistry.models.OperationLogSpecificationDefinition] - """ - - _attribute_map = { - "metric_specifications": {"key": "metricSpecifications", "type": "[OperationMetricSpecificationDefinition]"}, - "log_specifications": {"key": "logSpecifications", "type": "[OperationLogSpecificationDefinition]"}, - } - - def __init__( - self, - *, - metric_specifications: Optional[list["_models.OperationMetricSpecificationDefinition"]] = None, - log_specifications: Optional[list["_models.OperationLogSpecificationDefinition"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword metric_specifications: A list of Azure Monitoring metrics definition. - :paramtype metric_specifications: - list[~azure.mgmt.containerregistry.models.OperationMetricSpecificationDefinition] - :keyword log_specifications: A list of Azure Monitoring log definitions. - :paramtype log_specifications: - list[~azure.mgmt.containerregistry.models.OperationLogSpecificationDefinition] - """ - super().__init__(**kwargs) - self.metric_specifications = metric_specifications - self.log_specifications = log_specifications - - -class OverrideTaskStepProperties(_serialization.Model): - """OverrideTaskStepProperties. - - :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. - :vartype arguments: list[~azure.mgmt.containerregistry.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.models.SetValue] - :ivar update_trigger_token: Base64 encoded update trigger token that will be attached with the - base image trigger webhook. - :vartype 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, - *, - context_path: Optional[str] = None, - file: Optional[str] = None, - arguments: Optional[list["_models.Argument"]] = None, - target: Optional[str] = None, - values: Optional[list["_models.SetValue"]] = None, - update_trigger_token: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.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.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().__init__(**kwargs) - self.context_path = context_path - self.file = file - self.arguments = arguments - self.target = target - self.values = values - self.update_trigger_token = update_trigger_token - - -class ParentProperties(_serialization.Model): - """The properties of the connected registry parent. - - All required parameters must be populated in order to send to server. - - :ivar id: The resource ID of the parent to which the connected registry will be associated. - :vartype id: str - :ivar sync_properties: The sync properties of the connected registry with its parent. Required. - :vartype sync_properties: ~azure.mgmt.containerregistry.models.SyncProperties - """ - - _validation = { - "sync_properties": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "sync_properties": {"key": "syncProperties", "type": "SyncProperties"}, - } - - def __init__( - self, - *, - sync_properties: "_models.SyncProperties", - id: Optional[str] = None, # pylint: disable=redefined-builtin - **kwargs: Any - ) -> None: - """ - :keyword id: The resource ID of the parent to which the connected registry will be associated. - :paramtype id: str - :keyword sync_properties: The sync properties of the connected registry with its parent. - Required. - :paramtype sync_properties: ~azure.mgmt.containerregistry.models.SyncProperties - """ - super().__init__(**kwargs) - self.id = id - self.sync_properties = sync_properties - - -class PlatformProperties(_serialization.Model): - """The platform properties against which the run has to happen. - - All required parameters must be populated in order to send to server. - - :ivar os: The operating system type required for the run. Required. Known values are: "Windows" - and "Linux". - :vartype os: str or ~azure.mgmt.containerregistry.models.OS - :ivar architecture: The OS architecture. Known values are: "amd64", "x86", "386", "arm", and - "arm64". - :vartype architecture: str or ~azure.mgmt.containerregistry.models.Architecture - :ivar variant: Variant of the CPU. Known values are: "v6", "v7", and "v8". - :vartype variant: str or ~azure.mgmt.containerregistry.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, - *, - os: Union[str, "_models.OS"], - architecture: Optional[Union[str, "_models.Architecture"]] = None, - variant: Optional[Union[str, "_models.Variant"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword os: The operating system type required for the run. Required. Known values are: - "Windows" and "Linux". - :paramtype os: str or ~azure.mgmt.containerregistry.models.OS - :keyword architecture: The OS architecture. Known values are: "amd64", "x86", "386", "arm", and - "arm64". - :paramtype architecture: str or ~azure.mgmt.containerregistry.models.Architecture - :keyword variant: Variant of the CPU. Known values are: "v6", "v7", and "v8". - :paramtype variant: str or ~azure.mgmt.containerregistry.models.Variant - """ - super().__init__(**kwargs) - self.os = os - self.architecture = architecture - self.variant = variant - - -class PlatformUpdateParameters(_serialization.Model): - """The properties for updating the platform configuration. - - :ivar os: The operating system type required for the run. Known values are: "Windows" and - "Linux". - :vartype os: str or ~azure.mgmt.containerregistry.models.OS - :ivar architecture: The OS architecture. Known values are: "amd64", "x86", "386", "arm", and - "arm64". - :vartype architecture: str or ~azure.mgmt.containerregistry.models.Architecture - :ivar variant: Variant of the CPU. Known values are: "v6", "v7", and "v8". - :vartype variant: str or ~azure.mgmt.containerregistry.models.Variant - """ - - _attribute_map = { - "os": {"key": "os", "type": "str"}, - "architecture": {"key": "architecture", "type": "str"}, - "variant": {"key": "variant", "type": "str"}, - } - - def __init__( - self, - *, - os: Optional[Union[str, "_models.OS"]] = None, - architecture: Optional[Union[str, "_models.Architecture"]] = None, - variant: Optional[Union[str, "_models.Variant"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword os: The operating system type required for the run. Known values are: "Windows" and - "Linux". - :paramtype os: str or ~azure.mgmt.containerregistry.models.OS - :keyword architecture: The OS architecture. Known values are: "amd64", "x86", "386", "arm", and - "arm64". - :paramtype architecture: str or ~azure.mgmt.containerregistry.models.Architecture - :keyword variant: Variant of the CPU. Known values are: "v6", "v7", and "v8". - :paramtype variant: str or ~azure.mgmt.containerregistry.models.Variant - """ - super().__init__(**kwargs) - self.os = os - self.architecture = architecture - self.variant = variant - - -class Policies(_serialization.Model): - """The policies for a container registry. - - :ivar quarantine_policy: The quarantine policy for a container registry. - :vartype quarantine_policy: ~azure.mgmt.containerregistry.models.QuarantinePolicy - :ivar trust_policy: The content trust policy for a container registry. - :vartype trust_policy: ~azure.mgmt.containerregistry.models.TrustPolicy - :ivar retention_policy: The retention policy for a container registry. - :vartype retention_policy: ~azure.mgmt.containerregistry.models.RetentionPolicy - :ivar export_policy: The export policy for a container registry. - :vartype export_policy: ~azure.mgmt.containerregistry.models.ExportPolicy - :ivar azure_ad_authentication_as_arm_policy: The policy for using Azure Resource Manager - audience token for a container registry. - :vartype azure_ad_authentication_as_arm_policy: - ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicy - """ - - _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"}, - "azure_ad_authentication_as_arm_policy": { - "key": "azureADAuthenticationAsArmPolicy", - "type": "AzureADAuthenticationAsArmPolicy", - }, - } - - def __init__( - self, - *, - quarantine_policy: Optional["_models.QuarantinePolicy"] = None, - trust_policy: Optional["_models.TrustPolicy"] = None, - retention_policy: Optional["_models.RetentionPolicy"] = None, - export_policy: Optional["_models.ExportPolicy"] = None, - azure_ad_authentication_as_arm_policy: Optional["_models.AzureADAuthenticationAsArmPolicy"] = None, - **kwargs: Any - ) -> None: - """ - :keyword quarantine_policy: The quarantine policy for a container registry. - :paramtype quarantine_policy: ~azure.mgmt.containerregistry.models.QuarantinePolicy - :keyword trust_policy: The content trust policy for a container registry. - :paramtype trust_policy: ~azure.mgmt.containerregistry.models.TrustPolicy - :keyword retention_policy: The retention policy for a container registry. - :paramtype retention_policy: ~azure.mgmt.containerregistry.models.RetentionPolicy - :keyword export_policy: The export policy for a container registry. - :paramtype export_policy: ~azure.mgmt.containerregistry.models.ExportPolicy - :keyword azure_ad_authentication_as_arm_policy: The policy for using Azure Resource Manager - audience token for a container registry. - :paramtype azure_ad_authentication_as_arm_policy: - ~azure.mgmt.containerregistry.models.AzureADAuthenticationAsArmPolicy - """ - super().__init__(**kwargs) - self.quarantine_policy = quarantine_policy - self.trust_policy = trust_policy - self.retention_policy = retention_policy - self.export_policy = export_policy - self.azure_ad_authentication_as_arm_policy = azure_ad_authentication_as_arm_policy - - -class PrivateEndpoint(_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: Any) -> None: # pylint: disable=redefined-builtin - """ - :keyword id: This is private endpoint resource created with Microsoft.Network resource - provider. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -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: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar private_endpoint: The resource of private endpoint. - :vartype private_endpoint: ~azure.mgmt.containerregistry.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.models.PrivateLinkServiceConnectionState - :ivar provisioning_state: The provisioning state of private endpoint connection resource. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.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["_models.PrivateEndpoint"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionState"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: The resource of private endpoint. - :paramtype private_endpoint: ~azure.mgmt.containerregistry.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.models.PrivateLinkServiceConnectionState - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class PrivateEndpointConnectionListResult(_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.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["_models.PrivateEndpointConnection"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkResource(Resource): - """A private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "group_id": {"readonly": True}, - "required_members": {"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"}, - "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, *, required_zone_names: Optional[list[str]] = None, **kwargs: Any) -> None: - """ - :keyword required_zone_names: The private link resource private link DNS zone name. - :paramtype required_zone_names: list[str] - """ - super().__init__(**kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[list[str]] = None - self.required_zone_names = required_zone_names - - -class PrivateLinkResourceListResult(_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.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["_models.PrivateLinkResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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.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().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class PrivateLinkServiceConnectionState(_serialization.Model): - """The state of a private link service connection. - - :ivar status: The private link service connection status. Known values are: "Approved", - "Pending", "Rejected", and "Disconnected". - :vartype status: str or ~azure.mgmt.containerregistry.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. Known values are: "None" and "Recreate". - :vartype actions_required: str or ~azure.mgmt.containerregistry.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, "_models.ConnectionStatus"]] = None, - description: Optional[str] = None, - actions_required: Optional[Union[str, "_models.ActionsRequired"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword status: The private link service connection status. Known values are: "Approved", - "Pending", "Rejected", and "Disconnected". - :paramtype status: str or ~azure.mgmt.containerregistry.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. Known values are: "None" and "Recreate". - :paramtype actions_required: str or ~azure.mgmt.containerregistry.models.ActionsRequired - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required = actions_required - - -class QuarantinePolicy(_serialization.Model): - """The quarantine policy for a container registry. - - :ivar status: The value that indicates whether the policy is enabled or not. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - } - - def __init__(self, *, status: Optional[Union[str, "_models.PolicyStatus"]] = None, **kwargs: Any) -> None: - """ - :keyword status: The value that indicates whether the policy is enabled or not. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus - """ - super().__init__(**kwargs) - self.status = status - - -class RegenerateCredentialParameters(_serialization.Model): - """The parameters used to regenerate the login credential. - - All required parameters must be populated in order to send to server. - - :ivar name: Specifies name of the password which should be regenerated -- password or - password2. Required. Known values are: "password" and "password2". - :vartype name: str or ~azure.mgmt.containerregistry.models.PasswordName - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Union[str, "_models.PasswordName"], **kwargs: Any) -> None: - """ - :keyword name: Specifies name of the password which should be regenerated -- password or - password2. Required. Known values are: "password" and "password2". - :paramtype name: str or ~azure.mgmt.containerregistry.models.PasswordName - """ - super().__init__(**kwargs) - self.name = name - - -class Registry(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar sku: The SKU of the container registry. Required. - :vartype sku: ~azure.mgmt.containerregistry.models.Sku - :ivar identity: The identity of the container registry. - :vartype identity: ~azure.mgmt.containerregistry.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. Known values are: "Creating", "Updating", "Deleting", "Succeeded", - "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar status: The status of the container registry at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.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.models.NetworkRuleSet - :ivar policies: The policies for a container registry. - :vartype policies: ~azure.mgmt.containerregistry.models.Policies - :ivar encryption: The encryption settings of container registry. - :vartype encryption: ~azure.mgmt.containerregistry.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.models.PrivateEndpointConnection] - :ivar public_network_access: Whether or not public network access is allowed for the container - registry. Known values are: "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.containerregistry.models.PublicNetworkAccess - :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Known values are: "AzureServices" and "None". - :vartype network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions - :ivar network_rule_bypass_allowed_for_tasks: Whether or not Tasks allowed to bypass the network - rules for this container registry. - :vartype network_rule_bypass_allowed_for_tasks: bool - :ivar zone_redundancy: Whether or not zone redundancy is enabled for this container registry. - Known values are: "Enabled" and "Disabled". - :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy - :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :vartype anonymous_pull_enabled: bool - :ivar auto_generated_domain_name_label_scope: Determines the domain name label reuse scope. - Known values are: "Unsecure", "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and - "NoReuse". - :vartype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.containerregistry.models.AutoGeneratedDomainNameLabelScope - :ivar role_assignment_mode: Determines registry role assignment mode. Known values are: - "AbacRepositoryPermissions" and "LegacyRegistryPermissions". - :vartype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": 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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "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"}, - "network_rule_bypass_allowed_for_tasks": {"key": "properties.networkRuleBypassAllowedForTasks", "type": "bool"}, - "zone_redundancy": {"key": "properties.zoneRedundancy", "type": "str"}, - "anonymous_pull_enabled": {"key": "properties.anonymousPullEnabled", "type": "bool"}, - "auto_generated_domain_name_label_scope": { - "key": "properties.autoGeneratedDomainNameLabelScope", - "type": "str", - }, - "role_assignment_mode": {"key": "properties.roleAssignmentMode", "type": "str"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - sku: "_models.Sku", - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.IdentityProperties"] = None, - admin_user_enabled: bool = False, - network_rule_set: Optional["_models.NetworkRuleSet"] = None, - policies: Optional["_models.Policies"] = None, - encryption: Optional["_models.EncryptionProperty"] = None, - data_endpoint_enabled: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, - network_rule_bypass_allowed_for_tasks: bool = False, - zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = None, - anonymous_pull_enabled: bool = False, - auto_generated_domain_name_label_scope: Optional[ - Union[str, "_models.AutoGeneratedDomainNameLabelScope"] - ] = None, - role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword sku: The SKU of the container registry. Required. - :paramtype sku: ~azure.mgmt.containerregistry.models.Sku - :keyword identity: The identity of the container registry. - :paramtype identity: ~azure.mgmt.containerregistry.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.models.NetworkRuleSet - :keyword policies: The policies for a container registry. - :paramtype policies: ~azure.mgmt.containerregistry.models.Policies - :keyword encryption: The encryption settings of container registry. - :paramtype encryption: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.containerregistry.models.PublicNetworkAccess - :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a - network restricted registry. Known values are: "AzureServices" and "None". - :paramtype network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions - :keyword network_rule_bypass_allowed_for_tasks: Whether or not Tasks allowed to bypass the - network rules for this container registry. - :paramtype network_rule_bypass_allowed_for_tasks: bool - :keyword zone_redundancy: Whether or not zone redundancy is enabled for this container - registry. Known values are: "Enabled" and "Disabled". - :paramtype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy - :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :paramtype anonymous_pull_enabled: bool - :keyword auto_generated_domain_name_label_scope: Determines the domain name label reuse scope. - Known values are: "Unsecure", "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and - "NoReuse". - :paramtype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.containerregistry.models.AutoGeneratedDomainNameLabelScope - :keyword role_assignment_mode: Determines registry role assignment mode. Known values are: - "AbacRepositoryPermissions" and "LegacyRegistryPermissions". - :paramtype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode - """ - super().__init__(tags=tags, location=location, **kwargs) - self.sku = sku - self.identity = identity - self.login_server: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.status: Optional["_models.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: Optional[list[str]] = None - self.private_endpoint_connections: Optional[list["_models.PrivateEndpointConnection"]] = None - self.public_network_access = public_network_access - self.network_rule_bypass_options = network_rule_bypass_options - self.network_rule_bypass_allowed_for_tasks = network_rule_bypass_allowed_for_tasks - self.zone_redundancy = zone_redundancy - self.anonymous_pull_enabled = anonymous_pull_enabled - self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope - self.role_assignment_mode = role_assignment_mode - - -class RegistryListCredentialsResult(_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.models.RegistryPassword] - """ - - _attribute_map = { - "username": {"key": "username", "type": "str"}, - "passwords": {"key": "passwords", "type": "[RegistryPassword]"}, - } - - def __init__( - self, - *, - username: Optional[str] = None, - passwords: Optional[list["_models.RegistryPassword"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.RegistryPassword] - """ - super().__init__(**kwargs) - self.username = username - self.passwords = passwords - - -class RegistryListResult(_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.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["_models.Registry"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.Registry] - :keyword next_link: The URI that can be used to request the next list of container registries. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RegistryNameCheckRequest(_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 server. - - :ivar name: The name of the container registry. Required. - :vartype name: str - :ivar type: The resource type of the container registry. This field must be set to - 'Microsoft.ContainerRegistry/registries'. Required. Default value is - "Microsoft.ContainerRegistry/registries". - :vartype type: str - :ivar resource_group_name: The resource group name of the container registry. - :vartype resource_group_name: str - :ivar auto_generated_domain_name_label_scope: The auto generated domain name label of the - container registry. This value defaults to "Unsecure". Known values are: "Unsecure", - "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :vartype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.containerregistry.models.AutoGeneratedDomainNameLabelScope - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 5, "pattern": r"^[a-zA-Z0-9]*$"}, - "type": {"required": True, "constant": True}, - "resource_group_name": {"max_length": 90, "min_length": 1}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "resource_group_name": {"key": "resourceGroupName", "type": "str"}, - "auto_generated_domain_name_label_scope": {"key": "autoGeneratedDomainNameLabelScope", "type": "str"}, - } - - type = "Microsoft.ContainerRegistry/registries" - - def __init__( - self, - *, - name: str, - resource_group_name: Optional[str] = None, - auto_generated_domain_name_label_scope: Optional[ - Union[str, "_models.AutoGeneratedDomainNameLabelScope"] - ] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the container registry. Required. - :paramtype name: str - :keyword resource_group_name: The resource group name of the container registry. - :paramtype resource_group_name: str - :keyword auto_generated_domain_name_label_scope: The auto generated domain name label of the - container registry. This value defaults to "Unsecure". Known values are: "Unsecure", - "TenantReuse", "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :paramtype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.containerregistry.models.AutoGeneratedDomainNameLabelScope - """ - super().__init__(**kwargs) - self.name = name - self.resource_group_name = resource_group_name - self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope - - -class RegistryNameStatus(_serialization.Model): - """The result of a request to check the availability of a container registry name. - - :ivar available_login_server_name: The complete login server name with domain name label (DNL) - hash, if available. - :vartype available_login_server_name: 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 = { - "available_login_server_name": {"key": "availableLoginServerName", "type": "str"}, - "name_available": {"key": "nameAvailable", "type": "bool"}, - "reason": {"key": "reason", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__( - self, - *, - available_login_server_name: Optional[str] = None, - name_available: Optional[bool] = None, - reason: Optional[str] = None, - message: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_login_server_name: The complete login server name with domain name label - (DNL) hash, if available. - :paramtype available_login_server_name: str - :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().__init__(**kwargs) - self.available_login_server_name = available_login_server_name - self.name_available = name_available - self.reason = reason - self.message = message - - -class RegistryPassword(_serialization.Model): - """The login password for the container registry. - - :ivar name: The password name. Known values are: "password" and "password2". - :vartype name: str or ~azure.mgmt.containerregistry.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, "_models.PasswordName"]] = None, value: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword name: The password name. Known values are: "password" and "password2". - :paramtype name: str or ~azure.mgmt.containerregistry.models.PasswordName - :keyword value: The password value. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class RegistryUpdateParameters(_serialization.Model): - """The parameters for updating a container registry. - - :ivar identity: The identity of the container registry. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar 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.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.models.NetworkRuleSet - :ivar policies: The policies for a container registry. - :vartype policies: ~azure.mgmt.containerregistry.models.Policies - :ivar encryption: The encryption settings of container registry. - :vartype encryption: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". - :vartype public_network_access: str or ~azure.mgmt.containerregistry.models.PublicNetworkAccess - :ivar network_rule_bypass_options: Whether to allow trusted Azure services to access a network - restricted registry. Known values are: "AzureServices" and "None". - :vartype network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions - :ivar network_rule_bypass_allowed_for_tasks: Whether to allow ACR Tasks service to access a - network restricted registry. - :vartype network_rule_bypass_allowed_for_tasks: bool - :ivar anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :vartype anonymous_pull_enabled: bool - :ivar role_assignment_mode: Determines registry role assignment mode. Known values are: - "AbacRepositoryPermissions" and "LegacyRegistryPermissions". - :vartype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode - """ - - _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"}, - "network_rule_bypass_allowed_for_tasks": {"key": "properties.networkRuleBypassAllowedForTasks", "type": "bool"}, - "anonymous_pull_enabled": {"key": "properties.anonymousPullEnabled", "type": "bool"}, - "role_assignment_mode": {"key": "properties.roleAssignmentMode", "type": "str"}, - } - - def __init__( - self, - *, - identity: Optional["_models.IdentityProperties"] = None, - tags: Optional[dict[str, str]] = None, - sku: Optional["_models.Sku"] = None, - admin_user_enabled: Optional[bool] = None, - network_rule_set: Optional["_models.NetworkRuleSet"] = None, - policies: Optional["_models.Policies"] = None, - encryption: Optional["_models.EncryptionProperty"] = None, - data_endpoint_enabled: Optional[bool] = None, - public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = None, - network_rule_bypass_options: Optional[Union[str, "_models.NetworkRuleBypassOptions"]] = None, - network_rule_bypass_allowed_for_tasks: Optional[bool] = None, - anonymous_pull_enabled: Optional[bool] = None, - role_assignment_mode: Optional[Union[str, "_models.RoleAssignmentMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The identity of the container registry. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword 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.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.models.NetworkRuleSet - :keyword policies: The policies for a container registry. - :paramtype policies: ~azure.mgmt.containerregistry.models.Policies - :keyword encryption: The encryption settings of container registry. - :paramtype encryption: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". - :paramtype public_network_access: str or - ~azure.mgmt.containerregistry.models.PublicNetworkAccess - :keyword network_rule_bypass_options: Whether to allow trusted Azure services to access a - network restricted registry. Known values are: "AzureServices" and "None". - :paramtype network_rule_bypass_options: str or - ~azure.mgmt.containerregistry.models.NetworkRuleBypassOptions - :keyword network_rule_bypass_allowed_for_tasks: Whether to allow ACR Tasks service to access a - network restricted registry. - :paramtype network_rule_bypass_allowed_for_tasks: bool - :keyword anonymous_pull_enabled: Enables registry-wide pull from unauthenticated clients. - :paramtype anonymous_pull_enabled: bool - :keyword role_assignment_mode: Determines registry role assignment mode. Known values are: - "AbacRepositoryPermissions" and "LegacyRegistryPermissions". - :paramtype role_assignment_mode: str or ~azure.mgmt.containerregistry.models.RoleAssignmentMode - """ - super().__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 - self.network_rule_bypass_allowed_for_tasks = network_rule_bypass_allowed_for_tasks - self.anonymous_pull_enabled = anonymous_pull_enabled - self.role_assignment_mode = role_assignment_mode - - -class RegistryUsage(_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: int - :ivar current_value: The current value of the usage. - :vartype current_value: int - :ivar unit: The unit of measurement. Known values are: "Count" and "Bytes". - :vartype unit: str or ~azure.mgmt.containerregistry.models.RegistryUsageUnit - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "limit": {"key": "limit", "type": "int"}, - "current_value": {"key": "currentValue", "type": "int"}, - "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, "_models.RegistryUsageUnit"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the usage. - :paramtype name: str - :keyword limit: The limit of the usage. - :paramtype limit: int - :keyword current_value: The current value of the usage. - :paramtype current_value: int - :keyword unit: The unit of measurement. Known values are: "Count" and "Bytes". - :paramtype unit: str or ~azure.mgmt.containerregistry.models.RegistryUsageUnit - """ - super().__init__(**kwargs) - self.name = name - self.limit = limit - self.current_value = current_value - self.unit = unit - - -class RegistryUsageListResult(_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.models.RegistryUsage] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[RegistryUsage]"}, - } - - def __init__(self, *, value: Optional[list["_models.RegistryUsage"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of container registry quota usages. - :paramtype value: list[~azure.mgmt.containerregistry.models.RegistryUsage] - """ - super().__init__(**kwargs) - self.value = value - - -class Replication(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar provisioning_state: The provisioning state of the replication at the time the operation - was called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and - "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar status: The status of the replication at the time the operation was called. - :vartype status: ~azure.mgmt.containerregistry.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. Known values are: "Enabled" and "Disabled". - :vartype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "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: bool = True, - zone_redundancy: Optional[Union[str, "_models.ZoneRedundancy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword 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. Known values are: "Enabled" and "Disabled". - :paramtype zone_redundancy: str or ~azure.mgmt.containerregistry.models.ZoneRedundancy - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.status: Optional["_models.Status"] = None - self.region_endpoint_enabled = region_endpoint_enabled - self.zone_redundancy = zone_redundancy - - -class ReplicationListResult(_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.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["_models.Replication"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.Replication] - :keyword next_link: The URI that can be used to request the next list of replications. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ReplicationUpdateParameters(_serialization.Model): - """The parameters for updating a replication. - - :ivar 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: Any - ) -> None: - """ - :keyword 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().__init__(**kwargs) - self.tags = tags - self.region_endpoint_enabled = region_endpoint_enabled - - -class Request(_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, # pylint: disable=redefined-builtin - addr: Optional[str] = None, - host: Optional[str] = None, - method: Optional[str] = None, - useragent: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.id = id - self.addr = addr - self.host = host - self.method = method - self.useragent = useragent - - -class RetentionPolicy(_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. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.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: int = 7, status: Optional[Union[str, "_models.PolicyStatus"]] = None, **kwargs: Any - ) -> None: - """ - :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. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus - """ - super().__init__(**kwargs) - self.days = days - self.last_updated_time: Optional[datetime.datetime] = None - self.status = status - - -class Run(ProxyResource): - """Run resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar run_id: The unique identifier for the run. - :vartype run_id: str - :ivar status: The current status of the run. Known values are: "Queued", "Started", "Running", - "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :vartype status: str or ~azure.mgmt.containerregistry.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. Known values are: "QuickBuild", "QuickRun", "AutoBuild", and - "AutoRun". - :vartype run_type: str or ~azure.mgmt.containerregistry.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. - :vartype output_images: list[~azure.mgmt.containerregistry.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.models.ImageUpdateTrigger - :ivar source_trigger: The source trigger that caused the run. - :vartype source_trigger: ~azure.mgmt.containerregistry.models.SourceTriggerDescriptor - :ivar timer_trigger: The timer trigger that caused the run. - :vartype timer_trigger: ~azure.mgmt.containerregistry.models.TimerTriggerDescriptor - :ivar platform: The platform properties against which the run will happen. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.models.AgentProperties - :ivar source_registry_auth: The scope of the credentials that were used to login to the source - registry during this run. - :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 - :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.models.ImageDescriptor - :ivar provisioning_state: The provisioning state of a run. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. - :vartype 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__( # pylint: disable=too-many-locals - self, - *, - run_id: Optional[str] = None, - status: Optional[Union[str, "_models.RunStatus"]] = None, - last_updated_time: Optional[datetime.datetime] = None, - run_type: Optional[Union[str, "_models.RunType"]] = None, - agent_pool_name: Optional[str] = None, - create_time: Optional[datetime.datetime] = None, - start_time: Optional[datetime.datetime] = None, - finish_time: Optional[datetime.datetime] = None, - output_images: Optional[list["_models.ImageDescriptor"]] = None, - task: Optional[str] = None, - image_update_trigger: Optional["_models.ImageUpdateTrigger"] = None, - source_trigger: Optional["_models.SourceTriggerDescriptor"] = None, - timer_trigger: Optional["_models.TimerTriggerDescriptor"] = None, - platform: Optional["_models.PlatformProperties"] = None, - agent_configuration: Optional["_models.AgentProperties"] = None, - source_registry_auth: Optional[str] = None, - custom_registries: Optional[list[str]] = None, - update_trigger_token: Optional[str] = None, - provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None, - is_archive_enabled: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword run_id: The unique identifier for the run. - :paramtype run_id: str - :keyword status: The current status of the run. Known values are: "Queued", "Started", - "Running", "Succeeded", "Failed", "Canceled", "Error", and "Timeout". - :paramtype status: str or ~azure.mgmt.containerregistry.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. Known values are: "QuickBuild", "QuickRun", "AutoBuild", - and "AutoRun". - :paramtype run_type: str or ~azure.mgmt.containerregistry.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.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.models.ImageUpdateTrigger - :keyword source_trigger: The source trigger that caused the run. - :paramtype source_trigger: ~azure.mgmt.containerregistry.models.SourceTriggerDescriptor - :keyword timer_trigger: The timer trigger that caused the run. - :paramtype timer_trigger: ~azure.mgmt.containerregistry.models.TimerTriggerDescriptor - :keyword platform: The platform properties against which the run will happen. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :paramtype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. - :paramtype is_archive_enabled: bool - """ - super().__init__(**kwargs) - self.run_id = run_id - self.status = status - self.last_updated_time = last_updated_time - self.run_type = run_type - self.agent_pool_name = agent_pool_name - self.create_time = create_time - self.start_time = start_time - self.finish_time = finish_time - self.output_images = output_images - self.task = task - self.image_update_trigger = image_update_trigger - self.source_trigger = source_trigger - self.timer_trigger = timer_trigger - self.platform = platform - self.agent_configuration = agent_configuration - self.source_registry_auth = source_registry_auth - self.custom_registries = custom_registries - self.run_error_message: Optional[str] = None - self.update_trigger_token = update_trigger_token - self.log_artifact: Optional["_models.ImageDescriptor"] = None - self.provisioning_state = provisioning_state - self.is_archive_enabled = is_archive_enabled - - -class RunGetLogResult(_serialization.Model): - """The result of get log link operation. - - :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 = { - "log_link": {"key": "logLink", "type": "str"}, - "log_artifact_link": {"key": "logArtifactLink", "type": "str"}, - } - - def __init__( - self, *, log_link: Optional[str] = None, log_artifact_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.log_link = log_link - self.log_artifact_link = log_artifact_link - - -class RunListResult(_serialization.Model): - """The collection of runs. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[Run]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Run"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.models.Run] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class RunUpdateParameters(_serialization.Model): - """The set of run properties that can be updated. - - :ivar is_archive_enabled: The value that indicates whether archiving is enabled or not. - :vartype is_archive_enabled: bool - """ - - _attribute_map = { - "is_archive_enabled": {"key": "isArchiveEnabled", "type": "bool"}, - } - - def __init__(self, *, is_archive_enabled: Optional[bool] = None, **kwargs: Any) -> None: - """ - :keyword is_archive_enabled: The value that indicates whether archiving is enabled or not. - :paramtype is_archive_enabled: bool - """ - super().__init__(**kwargs) - self.is_archive_enabled = is_archive_enabled - - -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: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :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. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar actions: The list of scoped permissions for registry artifacts. - E.g. repositories/repository-name/content/read, - repositories/repository-name/metadata/write. - :vartype 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, *, description: Optional[str] = None, actions: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.description = description - self.type_properties_type: Optional[str] = None - self.creation_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.actions = actions - - -class ScopeMapListResult(_serialization.Model): - """The result of a request to list scope maps for a container registry. - - :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. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[ScopeMap]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.ScopeMap"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.ScopeMap] - :keyword next_link: The URI that can be used to request the next list of scope maps. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ScopeMapUpdateParameters(_serialization.Model): - """The properties for updating the scope map. - - :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. - :vartype actions: list[str] - """ - - _attribute_map = { - "description": {"key": "properties.description", "type": "str"}, - "actions": {"key": "properties.actions", "type": "[str]"}, - } - - def __init__( - self, *, description: Optional[str] = None, actions: Optional[list[str]] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.description = description - self.actions = actions - - -class SecretObject(_serialization.Model): - """Describes the properties of a secret object value. - - :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. - :vartype value: str - :ivar type: The type of the secret object which determines how the value of the secret object - has to be - interpreted. Known values are: "Opaque" and "Vaultsecret". - :vartype type: str or ~azure.mgmt.containerregistry.models.SecretObjectType - """ - - _attribute_map = { - "value": {"key": "value", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[str] = None, - type: Optional[Union[str, "_models.SecretObjectType"]] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: "Opaque" and "Vaultsecret". - :paramtype type: str or ~azure.mgmt.containerregistry.models.SecretObjectType - """ - super().__init__(**kwargs) - self.value = value - self.type = type - - -class SetValue(_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 server. - - :ivar name: The name of the overridable value. Required. - :vartype name: str - :ivar value: The overridable value. Required. - :vartype value: str - :ivar is_secret: Flag to indicate whether the value represents a secret or not. - :vartype 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, *, name: str, value: str, is_secret: bool = False, **kwargs: Any) -> None: - """ - :keyword name: The name of the overridable value. Required. - :paramtype name: str - :keyword value: The overridable value. Required. - :paramtype value: str - :keyword is_secret: Flag to indicate whether the value represents a secret or not. - :paramtype is_secret: bool - """ - super().__init__(**kwargs) - self.name = name - self.value = value - self.is_secret = is_secret - - -class Sku(_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 server. - - :ivar name: The SKU name of the container registry. Required for registry creation. Required. - Known values are: "Classic", "Basic", "Standard", and "Premium". - :vartype name: str or ~azure.mgmt.containerregistry.models.SkuName - :ivar tier: The SKU tier based on the SKU name. Known values are: "Classic", "Basic", - "Standard", and "Premium". - :vartype tier: str or ~azure.mgmt.containerregistry.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, "_models.SkuName"], **kwargs: Any) -> None: - """ - :keyword name: The SKU name of the container registry. Required for registry creation. - Required. Known values are: "Classic", "Basic", "Standard", and "Premium". - :paramtype name: str or ~azure.mgmt.containerregistry.models.SkuName - """ - super().__init__(**kwargs) - self.name = name - self.tier: Optional[Union[str, "_models.SkuTier"]] = None - - -class Source(_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: Any) -> None: - """ - :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().__init__(**kwargs) - self.addr = addr - self.instance_id = instance_id - - -class SourceProperties(_serialization.Model): - """The properties of the source code repository. - - All required parameters must be populated in order to send to server. - - :ivar source_control_type: The type of source control service. Required. Known values are: - "Github" and "VisualStudioTeamService". - :vartype source_control_type: str or ~azure.mgmt.containerregistry.models.SourceControlType - :ivar repository_url: The full URL to the source code repository. Required. - :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. - :vartype source_control_auth_properties: ~azure.mgmt.containerregistry.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, - *, - source_control_type: Union[str, "_models.SourceControlType"], - repository_url: str, - branch: Optional[str] = None, - source_control_auth_properties: Optional["_models.AuthInfo"] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_type: The type of source control service. Required. Known values are: - "Github" and "VisualStudioTeamService". - :paramtype source_control_type: str or ~azure.mgmt.containerregistry.models.SourceControlType - :keyword repository_url: The full URL to the source code repository. Required. - :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.models.AuthInfo - """ - super().__init__(**kwargs) - self.source_control_type = source_control_type - self.repository_url = repository_url - self.branch = branch - self.source_control_auth_properties = source_control_auth_properties - - -class SourceRegistryCredentials(_serialization.Model): - """Describes the credential parameters for accessing the source registry. - - :ivar identity: The Entra identity used for source registry login. - The value is ``[system]`` for system-assigned managed identity, ``[caller]`` for caller - identity, - and client ID for user-assigned managed identity. - :vartype identity: str - :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. Known values are: "None" and "Default". - :vartype login_mode: str or ~azure.mgmt.containerregistry.models.SourceRegistryLoginMode - """ - - _attribute_map = { - "identity": {"key": "identity", "type": "str"}, - "login_mode": {"key": "loginMode", "type": "str"}, - } - - def __init__( - self, - *, - identity: Optional[str] = None, - login_mode: Optional[Union[str, "_models.SourceRegistryLoginMode"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: The Entra identity used for source registry login. - The value is ``[system]`` for system-assigned managed identity, ``[caller]`` for caller - identity, - and client ID for user-assigned managed identity. - :paramtype identity: str - :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. Known values are: "None" and "Default". - :paramtype login_mode: str or ~azure.mgmt.containerregistry.models.SourceRegistryLoginMode - """ - super().__init__(**kwargs) - self.identity = identity - self.login_mode = login_mode - - -class SourceTrigger(_serialization.Model): - """The properties of a source based trigger. - - All required parameters must be populated in order to send to server. - - :ivar source_repository: The properties that describes the source(code) for the task. Required. - :vartype source_repository: ~azure.mgmt.containerregistry.models.SourceProperties - :ivar source_trigger_events: The source event corresponding to the trigger. Required. - :vartype source_trigger_events: list[str or - ~azure.mgmt.containerregistry.models.SourceTriggerEvent] - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, - *, - source_repository: "_models.SourceProperties", - source_trigger_events: list[Union[str, "_models.SourceTriggerEvent"]], - name: str, - status: Optional[Union[str, "_models.TriggerStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_repository: The properties that describes the source(code) for the task. - Required. - :paramtype source_repository: ~azure.mgmt.containerregistry.models.SourceProperties - :keyword source_trigger_events: The source event corresponding to the trigger. Required. - :paramtype source_trigger_events: list[str or - ~azure.mgmt.containerregistry.models.SourceTriggerEvent] - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.source_repository = source_repository - self.source_trigger_events = source_trigger_events - self.status = status - self.name = name - - -class SourceTriggerDescriptor(_serialization.Model): - """The source trigger that caused a run. - - :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 = { - "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, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - event_type: Optional[str] = None, - commit_id: Optional[str] = None, - pull_request_id: Optional[str] = None, - repository_url: Optional[str] = None, - branch_name: Optional[str] = None, - provider_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.id = id - self.event_type = event_type - self.commit_id = commit_id - self.pull_request_id = pull_request_id - self.repository_url = repository_url - self.branch_name = branch_name - self.provider_type = provider_type - - -class SourceTriggerUpdateParameters(_serialization.Model): - """The properties for updating a source based trigger. - - All required parameters must be populated in order to send to server. - - :ivar source_repository: The properties that describes the source(code) for the task. - :vartype source_repository: ~azure.mgmt.containerregistry.models.SourceUpdateParameters - :ivar source_trigger_events: The source event corresponding to the trigger. - :vartype source_trigger_events: list[str or - ~azure.mgmt.containerregistry.models.SourceTriggerEvent] - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, - *, - name: str, - source_repository: Optional["_models.SourceUpdateParameters"] = None, - source_trigger_events: Optional[list[Union[str, "_models.SourceTriggerEvent"]]] = None, - status: Optional[Union[str, "_models.TriggerStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_repository: The properties that describes the source(code) for the task. - :paramtype source_repository: ~azure.mgmt.containerregistry.models.SourceUpdateParameters - :keyword source_trigger_events: The source event corresponding to the trigger. - :paramtype source_trigger_events: list[str or - ~azure.mgmt.containerregistry.models.SourceTriggerEvent] - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.source_repository = source_repository - self.source_trigger_events = source_trigger_events - self.status = status - self.name = name - - -class SourceUpdateParameters(_serialization.Model): - """The properties for updating the source code repository. - - :ivar source_control_type: The type of source control service. Known values are: "Github" and - "VisualStudioTeamService". - :vartype source_control_type: str or ~azure.mgmt.containerregistry.models.SourceControlType - :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. - :vartype source_control_auth_properties: - ~azure.mgmt.containerregistry.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, - *, - source_control_type: Optional[Union[str, "_models.SourceControlType"]] = None, - repository_url: Optional[str] = None, - branch: Optional[str] = None, - source_control_auth_properties: Optional["_models.AuthInfoUpdateParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword source_control_type: The type of source control service. Known values are: "Github" - and "VisualStudioTeamService". - :paramtype source_control_type: str or ~azure.mgmt.containerregistry.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.models.AuthInfoUpdateParameters - """ - super().__init__(**kwargs) - self.source_control_type = source_control_type - self.repository_url = repository_url - self.branch = branch - self.source_control_auth_properties = source_control_auth_properties - - -class SourceUploadDefinition(_serialization.Model): - """The properties of a response to source upload request. - - :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. - :vartype relative_path: str - """ - - _attribute_map = { - "upload_url": {"key": "uploadUrl", "type": "str"}, - "relative_path": {"key": "relativePath", "type": "str"}, - } - - def __init__(self, *, upload_url: Optional[str] = None, relative_path: Optional[str] = None, **kwargs: Any) -> None: - """ - :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().__init__(**kwargs) - self.upload_url = upload_url - self.relative_path = relative_path - - -class Status(_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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.display_status: Optional[str] = None - self.message: Optional[str] = None - self.timestamp: Optional[datetime.datetime] = None - - -class StatusDetailProperties(_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 HTTP status code. - :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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - self.code: Optional[str] = None - self.description: Optional[str] = None - self.timestamp: Optional[datetime.datetime] = None - self.correlation_id: Optional[str] = None - - -class SyncProperties(_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 server. - - :ivar token_id: The resource ID of the ACR token used to authenticate the connected registry to - its parent during sync. Required. - :vartype token_id: str - :ivar schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :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. - :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. - Required. - :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 - :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, - *, - token_id: str, - message_ttl: datetime.timedelta, - schedule: Optional[str] = None, - sync_window: Optional[datetime.timedelta] = None, - **kwargs: Any - ) -> None: - """ - :keyword token_id: The resource ID of the ACR token used to authenticate the connected registry - to its parent during sync. Required. - :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: 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. - Required. - :paramtype message_ttl: ~datetime.timedelta - """ - super().__init__(**kwargs) - self.token_id = token_id - self.schedule = schedule - self.sync_window = sync_window - self.message_ttl = message_ttl - self.last_sync_time: Optional[datetime.datetime] = None - self.gateway_endpoint: Optional[str] = None - - -class SyncUpdateProperties(_serialization.Model): - """The parameters for updating the sync properties of the connected registry with its parent. - - :ivar schedule: The cron expression indicating the schedule that the connected registry will - sync with its parent. - :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. - :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. - :vartype 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, - *, - schedule: Optional[str] = None, - sync_window: Optional[datetime.timedelta] = None, - message_ttl: Optional[datetime.timedelta] = None, - **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.schedule = schedule - self.sync_window = sync_window - self.message_ttl = message_ttl - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.containerregistry.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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(_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: int - :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: int - :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": "int"}, - "digest": {"key": "digest", "type": "str"}, - "length": {"key": "length", "type": "int"}, - "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: Any - ) -> None: - """ - :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: int - :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: int - :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().__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 Task(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar provisioning_state: The provisioning state of the task. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar creation_date: The creation date of task. - :vartype creation_date: ~datetime.datetime - :ivar status: The current status of task. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TaskStatus - :ivar platform: The platform properties against which the run has to happen. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.models.AgentProperties - :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.models.TaskStepProperties - :ivar trigger: The properties that describe all triggers for the task. - :vartype trigger: ~azure.mgmt.containerregistry.models.TriggerProperties - :ivar credentials: The properties that describes a set of credentials that will be used when - this run is invoked. - :vartype credentials: ~azure.mgmt.containerregistry.models.Credentials - :ivar log_template: The template that describes the repository and tag information for run log - artifact. - :vartype log_template: str - :ivar is_system_task: The value of this property indicates whether the task resource is system - task or not. - :vartype is_system_task: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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"}, - "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, - *, - location: str, - tags: Optional[dict[str, str]] = None, - identity: Optional["_models.IdentityProperties"] = None, - status: Optional[Union[str, "_models.TaskStatus"]] = None, - platform: Optional["_models.PlatformProperties"] = None, - agent_configuration: Optional["_models.AgentProperties"] = None, - agent_pool_name: Optional[str] = None, - timeout: int = 3600, - step: Optional["_models.TaskStepProperties"] = None, - trigger: Optional["_models.TriggerProperties"] = None, - credentials: Optional["_models.Credentials"] = None, - log_template: Optional[str] = None, - is_system_task: bool = False, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword status: The current status of task. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TaskStatus - :keyword platform: The platform properties against which the run has to happen. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformProperties - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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.models.TaskStepProperties - :keyword trigger: The properties that describe all triggers for the task. - :paramtype trigger: ~azure.mgmt.containerregistry.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.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().__init__(tags=tags, location=location, **kwargs) - self.identity = identity - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.creation_date: Optional[datetime.datetime] = None - self.status = status - self.platform = platform - self.agent_configuration = agent_configuration - self.agent_pool_name = agent_pool_name - self.timeout = timeout - self.step = step - self.trigger = trigger - self.credentials = credentials - self.log_template = log_template - self.is_system_task = is_system_task - - -class TaskListResult(_serialization.Model): - """The collection of tasks. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[Task]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Task"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.models.Task] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -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: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar location: The location of the resource. - :vartype location: str - :ivar provisioning_state: The provisioning state of this task run. Known values are: - "Creating", "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar run_request: The request (parameters) for the run. - :vartype run_request: ~azure.mgmt.containerregistry.models.RunRequest - :ivar run_result: The result of this task run. - :vartype run_result: ~azure.mgmt.containerregistry.models.Run - :ivar force_update_tag: How the run should be forced to rerun even if the run request - configuration has not changed. - :vartype 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, - *, - identity: Optional["_models.IdentityProperties"] = None, - location: Optional[str] = None, - run_request: Optional["_models.RunRequest"] = None, - force_update_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.containerregistry.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.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().__init__(**kwargs) - self.identity = identity - self.location = location - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.run_request = run_request - self.run_result: Optional["_models.Run"] = None - self.force_update_tag = force_update_tag - - -class TaskRunListResult(_serialization.Model): - """The collection of task runs. - - :ivar value: The collection value. - :vartype value: list[~azure.mgmt.containerregistry.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 = { - "value": {"key": "value", "type": "[TaskRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.TaskRun"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection value. - :paramtype value: list[~azure.mgmt.containerregistry.models.TaskRun] - :keyword next_link: The URI that can be used to request the next set of paged results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class TaskRunRequest(RunRequest): - """The parameters for a task run request. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of the run request. Required. - :vartype type: str - :ivar is_archive_enabled: The value that indicates whether archiving is enabled for the run or - not. - :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. - :vartype log_template: str - :ivar task_id: The resource ID of task against which run has to be queued. Required. - :vartype task_id: str - :ivar override_task_step_properties: Set of overridable parameters that can be passed when - running a Task. - :vartype override_task_step_properties: - ~azure.mgmt.containerregistry.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, - *, - task_id: str, - is_archive_enabled: bool = False, - agent_pool_name: Optional[str] = None, - log_template: Optional[str] = None, - override_task_step_properties: Optional["_models.OverrideTaskStepProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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: The resource ID of task against which run has to be queued. Required. - :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.models.OverrideTaskStepProperties - """ - super().__init__( - is_archive_enabled=is_archive_enabled, agent_pool_name=agent_pool_name, log_template=log_template, **kwargs - ) - self.type: str = "TaskRunRequest" - self.task_id = task_id - self.override_task_step_properties = override_task_step_properties - - -class TaskRunUpdateParameters(_serialization.Model): - """The parameters for updating a task run. - - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar location: The location of the resource. - :vartype location: str - :ivar 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.models.RunRequest - :ivar force_update_tag: How the run should be forced to rerun even if the run request - configuration has not changed. - :vartype 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, - *, - identity: Optional["_models.IdentityProperties"] = None, - location: Optional[str] = None, - tags: Optional[dict[str, str]] = None, - run_request: Optional["_models.RunRequest"] = None, - force_update_tag: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword location: The location of the resource. - :paramtype location: str - :keyword 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.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().__init__(**kwargs) - self.identity = identity - self.location = location - self.tags = tags - self.run_request = run_request - self.force_update_tag = force_update_tag - - -class TaskUpdateParameters(_serialization.Model): - """The parameters for updating a task. - - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :ivar tags: The ARM resource tags. - :vartype tags: dict[str, str] - :ivar status: The current status of task. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TaskStatus - :ivar platform: The platform properties against which the run has to happen. - :vartype platform: ~azure.mgmt.containerregistry.models.PlatformUpdateParameters - :ivar agent_configuration: The machine configuration of the run agent. - :vartype agent_configuration: ~azure.mgmt.containerregistry.models.AgentProperties - :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.models.TaskStepUpdateParameters - :ivar trigger: The properties for updating trigger properties. - :vartype trigger: ~azure.mgmt.containerregistry.models.TriggerUpdateParameters - :ivar credentials: The parameters that describes a set of credentials that will be used when - this run is invoked. - :vartype credentials: ~azure.mgmt.containerregistry.models.Credentials - :ivar log_template: The template that describes the repository and tag information for run log - artifact. - :vartype 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, - *, - identity: Optional["_models.IdentityProperties"] = None, - tags: Optional[dict[str, str]] = None, - status: Optional[Union[str, "_models.TaskStatus"]] = None, - platform: Optional["_models.PlatformUpdateParameters"] = None, - agent_configuration: Optional["_models.AgentProperties"] = None, - agent_pool_name: Optional[str] = None, - timeout: Optional[int] = None, - step: Optional["_models.TaskStepUpdateParameters"] = None, - trigger: Optional["_models.TriggerUpdateParameters"] = None, - credentials: Optional["_models.Credentials"] = None, - log_template: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.containerregistry.models.IdentityProperties - :keyword tags: The ARM resource tags. - :paramtype tags: dict[str, str] - :keyword status: The current status of task. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TaskStatus - :keyword platform: The platform properties against which the run has to happen. - :paramtype platform: ~azure.mgmt.containerregistry.models.PlatformUpdateParameters - :keyword agent_configuration: The machine configuration of the run agent. - :paramtype agent_configuration: ~azure.mgmt.containerregistry.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.models.TaskStepUpdateParameters - :keyword trigger: The properties for updating trigger properties. - :paramtype trigger: ~azure.mgmt.containerregistry.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.models.Credentials - :keyword log_template: The template that describes the repository and tag information for run - log artifact. - :paramtype log_template: str - """ - super().__init__(**kwargs) - self.identity = identity - self.tags = tags - self.status = status - self.platform = platform - self.agent_configuration = agent_configuration - self.agent_pool_name = agent_pool_name - self.timeout = timeout - self.step = step - self.trigger = trigger - self.credentials = credentials - self.log_template = log_template - - -class TimerTrigger(_serialization.Model): - """The properties of a timer trigger. - - All required parameters must be populated in order to send to server. - - :ivar schedule: The CRON expression for the task schedule. Required. - :vartype schedule: str - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, *, schedule: str, name: str, status: Optional[Union[str, "_models.TriggerStatus"]] = None, **kwargs: Any - ) -> None: - """ - :keyword schedule: The CRON expression for the task schedule. Required. - :paramtype schedule: str - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.schedule = schedule - self.status = status - self.name = name - - -class TimerTriggerDescriptor(_serialization.Model): - """TimerTriggerDescriptor. - - :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 = { - "timer_trigger_name": {"key": "timerTriggerName", "type": "str"}, - "schedule_occurrence": {"key": "scheduleOccurrence", "type": "str"}, - } - - def __init__( - self, *, timer_trigger_name: Optional[str] = None, schedule_occurrence: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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().__init__(**kwargs) - self.timer_trigger_name = timer_trigger_name - self.schedule_occurrence = schedule_occurrence - - -class TimerTriggerUpdateParameters(_serialization.Model): - """The properties for updating a timer trigger. - - All required parameters must be populated in order to send to server. - - :ivar schedule: The CRON expression for the task schedule. - :vartype schedule: str - :ivar status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :ivar name: The name of the trigger. Required. - :vartype 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, - *, - name: str, - schedule: Optional[str] = None, - status: Optional[Union[str, "_models.TriggerStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword schedule: The CRON expression for the task schedule. - :paramtype schedule: str - :keyword status: The current status of trigger. Known values are: "Disabled" and "Enabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TriggerStatus - :keyword name: The name of the trigger. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.schedule = schedule - self.status = status - self.name = name - - -class TlsCertificateProperties(_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. "LocalDirectory" - :vartype type: str or ~azure.mgmt.containerregistry.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[Union[str, "_models.CertificateType"]] = None - self.location: Optional[str] = None - - -class TlsProperties(_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. Known values are: - "Enabled" and "Disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TlsStatus - :ivar certificate: The certificate used to configure HTTPS for the login server. - :vartype certificate: ~azure.mgmt.containerregistry.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: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.TlsStatus"]] = None - self.certificate: Optional["_models.TlsCertificateProperties"] = 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: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar creation_date: The creation date of scope map. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Provisioning state of the resource. Known values are: "Creating", - "Updating", "Deleting", "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - :ivar scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :vartype scope_map_id: str - :ivar credentials: The credentials that can be used for authenticating the token. - :vartype credentials: ~azure.mgmt.containerregistry.models.TokenCredentialsProperties - :ivar status: The status of the token example enabled or disabled. Known values are: "enabled" - and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.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, - *, - scope_map_id: Optional[str] = None, - credentials: Optional["_models.TokenCredentialsProperties"] = None, - status: Optional[Union[str, "_models.TokenStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :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.models.TokenCredentialsProperties - :keyword status: The status of the token example enabled or disabled. Known values are: - "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TokenStatus - """ - super().__init__(**kwargs) - self.creation_date: Optional[datetime.datetime] = None - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.scope_map_id = scope_map_id - self.credentials = credentials - self.status = status - - -class TokenCertificate(_serialization.Model): - """The properties of a certificate used for authenticating a token. - - :ivar name: Known values are: "certificate1" and "certificate2". - :vartype name: str or ~azure.mgmt.containerregistry.models.TokenCertificateName - :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. - :vartype 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, - *, - name: Optional[Union[str, "_models.TokenCertificateName"]] = None, - expiry: Optional[datetime.datetime] = None, - thumbprint: Optional[str] = None, - encoded_pem_certificate: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Known values are: "certificate1" and "certificate2". - :paramtype name: str or ~azure.mgmt.containerregistry.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().__init__(**kwargs) - self.name = name - self.expiry = expiry - self.thumbprint = thumbprint - self.encoded_pem_certificate = encoded_pem_certificate - - -class TokenCredentialsProperties(_serialization.Model): - """The properties of the credentials that can be used for authenticating the token. - - :ivar certificates: - :vartype certificates: list[~azure.mgmt.containerregistry.models.TokenCertificate] - :ivar passwords: - :vartype passwords: list[~azure.mgmt.containerregistry.models.TokenPassword] - """ - - _attribute_map = { - "certificates": {"key": "certificates", "type": "[TokenCertificate]"}, - "passwords": {"key": "passwords", "type": "[TokenPassword]"}, - } - - def __init__( - self, - *, - certificates: Optional[list["_models.TokenCertificate"]] = None, - passwords: Optional[list["_models.TokenPassword"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword certificates: - :paramtype certificates: list[~azure.mgmt.containerregistry.models.TokenCertificate] - :keyword passwords: - :paramtype passwords: list[~azure.mgmt.containerregistry.models.TokenPassword] - """ - super().__init__(**kwargs) - self.certificates = certificates - self.passwords = passwords - - -class TokenListResult(_serialization.Model): - """The result of a request to list tokens for a container registry. - - :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. - :vartype value: list[~azure.mgmt.containerregistry.models.Token] - :ivar next_link: The URI that can be used to request the next list of tokens. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[Token]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[list["_models.Token"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.Token] - :keyword next_link: The URI that can be used to request the next list of tokens. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class TokenPassword(_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. - - :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". Known values are: "password1" and - "password2". - :vartype name: str or ~azure.mgmt.containerregistry.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, - *, - creation_time: Optional[datetime.datetime] = None, - expiry: Optional[datetime.datetime] = None, - name: Optional[Union[str, "_models.TokenPasswordName"]] = None, - **kwargs: Any - ) -> None: - """ - :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". Known values are: "password1" and - "password2". - :paramtype name: str or ~azure.mgmt.containerregistry.models.TokenPasswordName - """ - super().__init__(**kwargs) - self.creation_time = creation_time - self.expiry = expiry - self.name = name - self.value: Optional[str] = None - - -class TokenUpdateParameters(_serialization.Model): - """The parameters for updating a token. - - :ivar scope_map_id: The resource ID of the scope map to which the token will be associated - with. - :vartype scope_map_id: str - :ivar status: The status of the token example enabled or disabled. Known values are: "enabled" - and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.TokenStatus - :ivar credentials: The credentials that can be used for authenticating the token. - :vartype credentials: ~azure.mgmt.containerregistry.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, - *, - scope_map_id: Optional[str] = None, - status: Optional[Union[str, "_models.TokenStatus"]] = None, - credentials: Optional["_models.TokenCredentialsProperties"] = None, - **kwargs: Any - ) -> None: - """ - :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. Known values are: - "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.TokenStatus - :keyword credentials: The credentials that can be used for authenticating the token. - :paramtype credentials: ~azure.mgmt.containerregistry.models.TokenCredentialsProperties - """ - super().__init__(**kwargs) - self.scope_map_id = scope_map_id - self.status = status - self.credentials = credentials - - -class TriggerProperties(_serialization.Model): - """The properties of a trigger. - - :ivar timer_triggers: The collection of timer triggers. - :vartype timer_triggers: list[~azure.mgmt.containerregistry.models.TimerTrigger] - :ivar source_triggers: The collection of triggers based on source code repository. - :vartype source_triggers: list[~azure.mgmt.containerregistry.models.SourceTrigger] - :ivar base_image_trigger: The trigger based on base image dependencies. - :vartype base_image_trigger: ~azure.mgmt.containerregistry.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, - *, - timer_triggers: Optional[list["_models.TimerTrigger"]] = None, - source_triggers: Optional[list["_models.SourceTrigger"]] = None, - base_image_trigger: Optional["_models.BaseImageTrigger"] = None, - **kwargs: Any - ) -> None: - """ - :keyword timer_triggers: The collection of timer triggers. - :paramtype timer_triggers: list[~azure.mgmt.containerregistry.models.TimerTrigger] - :keyword source_triggers: The collection of triggers based on source code repository. - :paramtype source_triggers: list[~azure.mgmt.containerregistry.models.SourceTrigger] - :keyword base_image_trigger: The trigger based on base image dependencies. - :paramtype base_image_trigger: ~azure.mgmt.containerregistry.models.BaseImageTrigger - """ - super().__init__(**kwargs) - self.timer_triggers = timer_triggers - self.source_triggers = source_triggers - self.base_image_trigger = base_image_trigger - - -class TriggerUpdateParameters(_serialization.Model): - """The properties for updating triggers. - - :ivar timer_triggers: The collection of timer triggers. - :vartype timer_triggers: - list[~azure.mgmt.containerregistry.models.TimerTriggerUpdateParameters] - :ivar source_triggers: The collection of triggers based on source code repository. - :vartype source_triggers: - list[~azure.mgmt.containerregistry.models.SourceTriggerUpdateParameters] - :ivar base_image_trigger: The trigger based on base image dependencies. - :vartype base_image_trigger: - ~azure.mgmt.containerregistry.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, - *, - timer_triggers: Optional[list["_models.TimerTriggerUpdateParameters"]] = None, - source_triggers: Optional[list["_models.SourceTriggerUpdateParameters"]] = None, - base_image_trigger: Optional["_models.BaseImageTriggerUpdateParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword timer_triggers: The collection of timer triggers. - :paramtype timer_triggers: - list[~azure.mgmt.containerregistry.models.TimerTriggerUpdateParameters] - :keyword source_triggers: The collection of triggers based on source code repository. - :paramtype source_triggers: - list[~azure.mgmt.containerregistry.models.SourceTriggerUpdateParameters] - :keyword base_image_trigger: The trigger based on base image dependencies. - :paramtype base_image_trigger: - ~azure.mgmt.containerregistry.models.BaseImageTriggerUpdateParameters - """ - super().__init__(**kwargs) - self.timer_triggers = timer_triggers - self.source_triggers = source_triggers - self.base_image_trigger = base_image_trigger - - -class TrustPolicy(_serialization.Model): - """The content trust policy for a container registry. - - :ivar type: The type of trust policy. "Notary" - :vartype type: str or ~azure.mgmt.containerregistry.models.TrustPolicyType - :ivar status: The value that indicates whether the policy is enabled or not. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus - """ - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "status": {"key": "status", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.TrustPolicyType"] = "Notary", - status: Optional[Union[str, "_models.PolicyStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of trust policy. "Notary" - :paramtype type: str or ~azure.mgmt.containerregistry.models.TrustPolicyType - :keyword status: The value that indicates whether the policy is enabled or not. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.models.PolicyStatus - """ - super().__init__(**kwargs) - self.type = type - self.status = status - - -class UserIdentityProperties(_serialization.Model): - """UserIdentityProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.client_id: Optional[str] = None - - -class Webhook(TrackedResource): - """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 server. - - :ivar id: Fully qualified resource ID for the resource. E.g. - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}". - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerregistry.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar status: The status of the webhook at the time the operation was called. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.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.models.WebhookAction] - :ivar provisioning_state: The provisioning state of the webhook at the time the operation was - called. Known values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", and - "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.containerregistry.models.ProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"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"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "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, - *, - location: str, - tags: Optional[dict[str, str]] = None, - status: Optional[Union[str, "_models.WebhookStatus"]] = None, - scope: Optional[str] = None, - actions: Optional[list[Union[str, "_models.WebhookAction"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword status: The status of the webhook at the time the operation was called. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.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.models.WebhookAction] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.status = status - self.scope = scope - self.actions = actions - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - - -class WebhookCreateParameters(_serialization.Model): - """The parameters for creating a webhook. - - All required parameters must be populated in order to send to server. - - :ivar tags: The tags for the webhook. - :vartype tags: dict[str, str] - :ivar location: The location of the webhook. This cannot be changed after the resource is - created. Required. - :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. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.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.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, "_models.WebhookStatus"]] = None, - scope: Optional[str] = None, - actions: Optional[list[Union[str, "_models.WebhookAction"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: The tags for the webhook. - :paramtype tags: dict[str, str] - :keyword location: The location of the webhook. This cannot be changed after the resource is - created. Required. - :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. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.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.models.WebhookAction] - """ - super().__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(_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.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["_models.Webhook"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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.models.Webhook] - :keyword next_link: The URI that can be used to request the next list of webhooks. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class WebhookUpdateParameters(_serialization.Model): - """The parameters for updating a webhook. - - :ivar 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. Known values are: - "enabled" and "disabled". - :vartype status: str or ~azure.mgmt.containerregistry.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.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, "_models.WebhookStatus"]] = None, - scope: Optional[str] = None, - actions: Optional[list[Union[str, "_models.WebhookAction"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword 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. Known values - are: "enabled" and "disabled". - :paramtype status: str or ~azure.mgmt.containerregistry.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.models.WebhookAction] - """ - super().__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/models/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_patch.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/__init__.py index 1c6b64d3cdfb..5dad0f409b6a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,19 +13,15 @@ from ._patch import * # pylint: disable=unused-wildcard-import from ._operations import Operations # type: ignore -from ._registries_operations import RegistriesOperations # type: ignore -from ._cache_rules_operations import CacheRulesOperations # type: ignore -from ._connected_registries_operations import ConnectedRegistriesOperations # type: ignore -from ._credential_sets_operations import CredentialSetsOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._replications_operations import ReplicationsOperations # type: ignore -from ._scope_maps_operations import ScopeMapsOperations # type: ignore -from ._tokens_operations import TokensOperations # type: ignore -from ._webhooks_operations import WebhooksOperations # type: ignore -from ._agent_pools_operations import AgentPoolsOperations # type: ignore -from ._runs_operations import RunsOperations # type: ignore -from ._task_runs_operations import TaskRunsOperations # type: ignore -from ._tasks_operations import TasksOperations # type: ignore +from ._operations import RegistriesOperations # type: ignore +from ._operations import CacheRulesOperations # type: ignore +from ._operations import CredentialSetsOperations # type: ignore +from ._operations import ConnectedRegistriesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import ReplicationsOperations # type: ignore +from ._operations import ScopeMapsOperations # type: ignore +from ._operations import TokensOperations # type: ignore +from ._operations import WebhooksOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * @@ -35,17 +31,13 @@ "Operations", "RegistriesOperations", "CacheRulesOperations", - "ConnectedRegistriesOperations", "CredentialSetsOperations", + "ConnectedRegistriesOperations", "PrivateEndpointConnectionsOperations", "ReplicationsOperations", "ScopeMapsOperations", "TokensOperations", "WebhooksOperations", - "AgentPoolsOperations", - "RunsOperations", - "TaskRunsOperations", - "TasksOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_agent_pools_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_agent_pools_operations.py deleted file mode 100644 index 2f84b96a983c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_agent_pools_operations.py +++ /dev/null @@ -1,1046 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_queue_status_request( - resource_group_name: str, registry_name: str, agent_pool_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class AgentPoolsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`agent_pools` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.AgentPool"]: - """Lists all the agent pools for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either AgentPool or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPoolListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AgentPoolListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: AgentPool or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.AgentPool - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(agent_pool, (IOBase, bytes)): - _content = agent_pool - else: - _json = self._serialize.body(agent_pool, "AgentPool") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: _models.AgentPool, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Required. - :type agent_pool: ~azure.mgmt.containerregistry.models.AgentPool - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Required. - :type agent_pool: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - agent_pool: Union[_models.AgentPool, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param agent_pool: The parameters of an agent pool that needs to scheduled. Is either a - AgentPool type or a IO[bytes] type. Required. - :type agent_pool: ~azure.mgmt.containerregistry.models.AgentPool or IO[bytes] - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - agent_pool=agent_pool, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: Union[_models.AgentPoolUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_parameters, (IOBase, bytes)): - _content = update_parameters - else: - _json = self._serialize.body(update_parameters, "AgentPoolUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: _models.AgentPoolUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.AgentPoolUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Required. - :type update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - agent_pool_name: str, - update_parameters: Union[_models.AgentPoolUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.AgentPool]: - """Updates an agent pool with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :param update_parameters: The parameters for updating an agent pool. Is either a - AgentPoolUpdateParameters type or a IO[bytes] type. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.AgentPoolUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either AgentPool or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.AgentPool] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AgentPool] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - update_parameters=update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AgentPool", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AgentPool].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AgentPool]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, agent_pool_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get_queue_status( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param agent_pool_name: The name of the agent pool. Required. - :type agent_pool_name: str - :return: AgentPoolQueueStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.AgentPoolQueueStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.AgentPoolQueueStatus] = kwargs.pop("cls", None) - - _request = build_get_queue_status_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - agent_pool_name=agent_pool_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AgentPoolQueueStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_cache_rules_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_cache_rules_operations.py deleted file mode 100644 index c7cdfd54a80e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_cache_rules_operations.py +++ /dev/null @@ -1,945 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "cacheRuleName": _SERIALIZER.url( - "cache_rule_name", cache_rule_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "cacheRuleName": _SERIALIZER.url( - "cache_rule_name", cache_rule_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "cacheRuleName": _SERIALIZER.url( - "cache_rule_name", cache_rule_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "cacheRuleName": _SERIALIZER.url( - "cache_rule_name", cache_rule_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CacheRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`cache_rules` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.CacheRule"]: - """Lists all cache rule resources for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either CacheRule or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CacheRulesListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CacheRulesListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> _models.CacheRule: - """Gets the properties of the specified cache rule resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :return: CacheRule or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CacheRule - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CacheRule", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: Union[_models.CacheRule, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache_rule_create_parameters, (IOBase, bytes)): - _content = cache_rule_create_parameters - else: - _json = self._serialize.body(cache_rule_create_parameters, "CacheRule") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: _models.CacheRule, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. - :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. - :type cache_rule_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_create_parameters: Union[_models.CacheRule, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Creates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_create_parameters: The parameters for creating a cache rule. Is either a - CacheRule type or a IO[bytes] type. Required. - :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule or IO[bytes] - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - cache_rule_create_parameters=cache_rule_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CacheRule", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CacheRule].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CacheRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(cache_rule_update_parameters, (IOBase, bytes)): - _content = cache_rule_update_parameters - else: - _json = self._serialize.body(cache_rule_update_parameters, "CacheRuleUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: _models.CacheRuleUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. - :type cache_rule_update_parameters: - ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. - :type cache_rule_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - cache_rule_name: str, - cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CacheRule]: - """Updates a cache rule for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :param cache_rule_update_parameters: The parameters for updating a cache rule. Is either a - CacheRuleUpdateParameters type or a IO[bytes] type. Required. - :type cache_rule_update_parameters: - ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either CacheRule or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - cache_rule_update_parameters=cache_rule_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CacheRule", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CacheRule].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CacheRule]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a cache rule resource from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param cache_rule_name: The name of the cache rule. Required. - :type cache_rule_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - cache_rule_name=cache_rule_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_connected_registries_operations.py deleted file mode 100644 index ad1c6aa240b2..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_connected_registries_operations.py +++ /dev/null @@ -1,1150 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_deactivate_request( - resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ConnectedRegistriesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`connected_registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, filter: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.ConnectedRegistry"]: - """Lists all connected registries for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param filter: An OData filter expression that describes a subset of connectedRegistries to - return. The parameters that can be filtered are parent.id (the resource id of the - connectedRegistry parent), mode, and connectionState. The supported operator is eq. Default - value is None. - :type filter: str - :return: An iterator like instance of either ConnectedRegistry or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ConnectedRegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ConnectedRegistryListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: ConnectedRegistry or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.ConnectedRegistry - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ConnectedRegistry", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: Union[_models.ConnectedRegistry, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(connected_registry_create_parameters, (IOBase, bytes)): - _content = connected_registry_create_parameters - else: - _json = self._serialize.body(connected_registry_create_parameters, "ConnectedRegistry") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: _models.ConnectedRegistry, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Required. - :type connected_registry_create_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistry - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Required. - :type connected_registry_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_create_parameters: Union[_models.ConnectedRegistry, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. - Is either a ConnectedRegistry type or a IO[bytes] type. Required. - :type connected_registry_create_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistry or IO[bytes] - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - connected_registry_create_parameters=connected_registry_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedRegistry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConnectedRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConnectedRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(connected_registry_update_parameters, (IOBase, bytes)): - _content = connected_registry_update_parameters - else: - _json = self._serialize.body(connected_registry_update_parameters, "ConnectedRegistryUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: _models.ConnectedRegistryUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Required. - :type connected_registry_update_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Required. - :type connected_registry_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - connected_registry_name: str, - connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ConnectedRegistry]: - """Updates a connected registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. - Is either a ConnectedRegistryUpdateParameters type or a IO[bytes] type. Required. - :type connected_registry_update_parameters: - ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ConnectedRegistry or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - connected_registry_update_parameters=connected_registry_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ConnectedRegistry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ConnectedRegistry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ConnectedRegistry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _deactivate_initial( - self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_deactivate_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_deactivate( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param connected_registry_name: The name of the connected registry. Required. - :type connected_registry_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._deactivate_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - connected_registry_name=connected_registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_credential_sets_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_credential_sets_operations.py deleted file mode 100644 index bab05914b9da..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_credential_sets_operations.py +++ /dev/null @@ -1,956 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "credentialSetName": _SERIALIZER.url( - "credential_set_name", credential_set_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "credentialSetName": _SERIALIZER.url( - "credential_set_name", credential_set_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "credentialSetName": _SERIALIZER.url( - "credential_set_name", credential_set_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - "credentialSetName": _SERIALIZER.url( - "credential_set_name", credential_set_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9-]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class CredentialSetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`credential_sets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.CredentialSet"]: - """Lists all credential set resources for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either CredentialSet or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CredentialSetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("CredentialSetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> _models.CredentialSet: - """Gets the properties of the specified credential set resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :return: CredentialSet or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CredentialSet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CredentialSet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: Union[_models.CredentialSet, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(credential_set_create_parameters, (IOBase, bytes)): - _content = credential_set_create_parameters - else: - _json = self._serialize.body(credential_set_create_parameters, "CredentialSet") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: _models.CredentialSet, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. - Required. - :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. - Required. - :type credential_set_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_create_parameters: Union[_models.CredentialSet, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Creates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_create_parameters: The parameters for creating a credential set. Is - either a CredentialSet type or a IO[bytes] type. Required. - :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet or - IO[bytes] - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - credential_set_create_parameters=credential_set_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CredentialSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CredentialSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CredentialSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(credential_set_update_parameters, (IOBase, bytes)): - _content = credential_set_update_parameters - else: - _json = self._serialize.body(credential_set_update_parameters, "CredentialSetUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: _models.CredentialSetUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. - Required. - :type credential_set_update_parameters: - ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. - Required. - :type credential_set_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - credential_set_name: str, - credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.CredentialSet]: - """Updates a credential set for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :param credential_set_update_parameters: The parameters for updating a credential set. Is - either a CredentialSetUpdateParameters type or a IO[bytes] type. Required. - :type credential_set_update_parameters: - ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either CredentialSet or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - credential_set_update_parameters=credential_set_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("CredentialSet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.CredentialSet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.CredentialSet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a credential set from a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param credential_set_name: The name of the credential set. Required. - :type credential_set_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - credential_set_name=credential_set_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py index 2834c0991eef..5a0c62f8559a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py @@ -1,12 +1,16 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from collections.abc import MutableMapping -from typing import Any, Callable, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload +import urllib.parse from azure.core import PipelineClient from azure.core.exceptions import ( @@ -15,28 +19,34 @@ ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, + StreamClosedError, + StreamConsumedError, map_error, ) from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod from azure.core.rest import HttpRequest, HttpResponse from azure.core.tracing.decorator import distributed_trace from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration +from .._configuration import ContainerRegistryClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] List = list _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -44,7 +54,7 @@ def build_list_request(**kwargs: Any) -> HttpRequest: accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerRegistry/operations") + _url = "/providers/Microsoft.ContainerRegistry/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,40 +65,10190 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_registries_get_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_create_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_update_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_delete_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_registries_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/registries" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_import_image_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_list_usages_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_list_credentials_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_regenerate_credential_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_generate_credentials_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_check_name_availability_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_get_private_link_resource_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "groupName": _SERIALIZER.url("group_name", group_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_registries_list_private_link_resources_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cache_rules_get_request( + resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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"), + "cacheRuleName": _SERIALIZER.url("cache_rule_name", cache_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cache_rules_create_request( + resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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"), + "cacheRuleName": _SERIALIZER.url("cache_rule_name", cache_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cache_rules_update_request( + resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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"), + "cacheRuleName": _SERIALIZER.url("cache_rule_name", cache_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_cache_rules_delete_request( + resource_group_name: str, registry_name: str, cache_rule_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules/{cacheRuleName}" + 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"), + "cacheRuleName": _SERIALIZER.url("cache_rule_name", cache_rule_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_cache_rules_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/cacheRules" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_credential_sets_get_request( + resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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"), + "credentialSetName": _SERIALIZER.url("credential_set_name", credential_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_credential_sets_create_request( + resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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"), + "credentialSetName": _SERIALIZER.url("credential_set_name", credential_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_credential_sets_update_request( + resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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"), + "credentialSetName": _SERIALIZER.url("credential_set_name", credential_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_credential_sets_delete_request( + resource_group_name: str, registry_name: str, credential_set_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets/{credentialSetName}" + 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"), + "credentialSetName": _SERIALIZER.url("credential_set_name", credential_set_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_credential_sets_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/credentialSets" + 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"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_registries_get_request( + resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_registries_create_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_registries_update_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_registries_delete_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_connected_registries_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, *, filter: Optional[str] = None, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if filter is not None: + _params["$filter"] = _SERIALIZER.query("filter", filter, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_connected_registries_deactivate_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, connected_registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "connectedRegistryName": _SERIALIZER.url("connected_registry_name", connected_registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="POST", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_get_request( # pylint: disable=name-too-long + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_private_endpoint_connections_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "privateEndpointConnectionName": _SERIALIZER.url( + "private_endpoint_connection_name", private_endpoint_connection_name, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_private_endpoint_connections_list_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replications_get_request( + resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "replicationName": _SERIALIZER.url("replication_name", replication_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replications_create_request( + resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "replicationName": _SERIALIZER.url("replication_name", replication_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replications_update_request( + resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "replicationName": _SERIALIZER.url("replication_name", replication_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_replications_delete_request( + resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "replicationName": _SERIALIZER.url("replication_name", replication_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_replications_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_maps_get_request( + resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_maps_create_request( + resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_maps_update_request( + resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_scope_maps_delete_request( + resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "scopeMapName": _SERIALIZER.url("scope_map_name", scope_map_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_scope_maps_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tokens_get_request( + resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "tokenName": _SERIALIZER.url("token_name", token_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tokens_create_request( + resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "tokenName": _SERIALIZER.url("token_name", token_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tokens_update_request( + resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "tokenName": _SERIALIZER.url("token_name", token_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_tokens_delete_request( + resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "tokenName": _SERIALIZER.url("token_name", token_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_tokens_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_get_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_create_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_update_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + if content_type is not None: + _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_delete_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + return HttpRequest(method="DELETE", url=_url, params=_params, **kwargs) + + +def build_webhooks_list_request( + resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_ping_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_list_events_request( + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_webhooks_get_callback_config_request( # pylint: disable=name-too-long + resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _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"), + "registryName": _SERIALIZER.url("registry_name", registry_name, "str"), + "webhookName": _SERIALIZER.url("webhook_name", webhook_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) + + class Operations: """ .. warning:: **DO NOT** instantiate this class directly. - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`operations` attribute. - """ + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`operations` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.OperationDefinition"]: + """List the operations for the provider. + + :return: An iterator like instance of OperationDefinition + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.OperationDefinition] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationDefinition]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationDefinition], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class RegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`registries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: Registry. The Registry is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Registry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + + _request = build_registries_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Registry, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + registry: Union[_models.Registry, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry, (IOBase, bytes)): + _content = registry + else: + _content = json.dumps(registry, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: _models.Registry, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: ~azure.mgmt.containerregistry.models.Registry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Required. + :type registry: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + registry: Union[_models.Registry, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Creates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry: The parameters for creating a container registry. Is one of the following + types: Registry, JSON, IO[bytes] Required. + :type registry: ~azure.mgmt.containerregistry.models.Registry or JSON or IO[bytes] + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry=registry, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Registry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Registry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: Union[_models.RegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry_update_parameters, (IOBase, bytes)): + _content = registry_update_parameters + else: + _content = json.dumps(registry_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: _models.RegistryUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Required. + :type registry_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + registry_update_parameters: Union[_models.RegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Registry]: + """Updates a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param registry_update_parameters: The parameters for updating a container registry. Is one of + the following types: RegistryUpdateParameters, JSON, IO[bytes] Required. + :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters + or JSON or IO[bytes] + :return: An instance of LROPoller that returns Registry. The Registry is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Registry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + registry_update_parameters=registry_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Registry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Registry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Registry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_registries_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Registry"]: + """Lists all the container registries under the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of Registry + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Registry]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registries_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Registry], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list(self, **kwargs: Any) -> ItemPaged["_models.Registry"]: + """Lists all the container registries under the specified subscription. + + :return: An iterator like instance of Registry + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Registry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Registry]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registries_list_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Registry], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _import_image_initial( + self, + resource_group_name: str, + registry_name: str, + parameters: Union[_models.ImportImageParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_import_image_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: _models.ImportImageParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_import_image( + self, + resource_group_name: str, + registry_name: str, + parameters: Union[_models.ImportImageParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param parameters: The parameters specifying the image to copy and the source container + registry. Is one of the following types: ImportImageParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters or JSON or + IO[bytes] + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: RegistryUsageListResult. The RegistryUsageListResult is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryUsageListResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegistryUsageListResult] = kwargs.pop("cls", None) + + _request = build_registries_list_usages_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryUsageListResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) + + _request = build_registries_list_credentials_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryListCredentialsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: _models.RegenerateCredentialParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Required. + :type regenerate_credential_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def regenerate_credential( + self, + resource_group_name: str, + registry_name: str, + regenerate_credential_parameters: Union[_models.RegenerateCredentialParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param regenerate_credential_parameters: Specifies name of the password which should be + regenerated -- password or password2. Is one of the following types: + RegenerateCredentialParameters, JSON, IO[bytes] Required. + :type regenerate_credential_parameters: + ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters or JSON or IO[bytes] + :return: RegistryListCredentialsResult. The RegistryListCredentialsResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(regenerate_credential_parameters, (IOBase, bytes)): + _content = regenerate_credential_parameters + else: + _content = json.dumps(regenerate_credential_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_regenerate_credential_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryListCredentialsResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _generate_credentials_initial( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(generate_credentials_parameters, (IOBase, bytes)): + _content = generate_credentials_parameters + else: + _content = json.dumps(generate_credentials_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_generate_credentials_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: _models.GenerateCredentialsParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Required. + :type generate_credentials_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_generate_credentials( + self, + resource_group_name: str, + registry_name: str, + generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param generate_credentials_parameters: The parameters for generating credentials. Is one of + the following types: GenerateCredentialsParameters, JSON, IO[bytes] Required. + :type generate_credentials_parameters: + ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns GenerateCredentialsResult. The + GenerateCredentialsResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.GenerateCredentialsResult] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._generate_credentials_initial( + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response_headers = {} + response = pipeline_response.http_response + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = _deserialize(_models.GenerateCredentialsResult, response.json()) + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.GenerateCredentialsResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.GenerateCredentialsResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def check_name_availability( + self, + registry_name_check_request: _models.RegistryNameCheckRequest, + *, + content_type: str = "application/json", + **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 request body. Required. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, registry_name_check_request: JSON, *, content_type: str = "application/json", **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 request body. Required. + :type registry_name_check_request: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def check_name_availability( + self, registry_name_check_request: IO[bytes], *, content_type: str = "application/json", **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 request body. Required. + :type registry_name_check_request: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def check_name_availability( + self, registry_name_check_request: Union[_models.RegistryNameCheckRequest, JSON, IO[bytes]], **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 request body. Is one of the following types: + RegistryNameCheckRequest, JSON, IO[bytes] Required. + :type registry_name_check_request: + ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest or JSON or IO[bytes] + :return: RegistryNameStatus. The RegistryNameStatus is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.RegistryNameStatus] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(registry_name_check_request, (IOBase, bytes)): + _content = registry_name_check_request + else: + _content = json.dumps(registry_name_check_request, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_registries_check_name_availability_request( + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.RegistryNameStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param group_name: The name of the private link associated with the Azure resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.PrivateLinkResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) + + _request = build_registries_get_private_link_resource_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + group_name=group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_private_link_resources( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Lists the private link resources for a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.PrivateLinkResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateLinkResource]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_registries_list_private_link_resources_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateLinkResource], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CacheRulesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`cache_rules` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> _models.CacheRule: + """Gets the properties of the specified cache rule resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :return: CacheRule. The CacheRule is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CacheRule + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + + _request = build_cache_rules_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CacheRule, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: Union[_models.CacheRule, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(cache_rule_create_parameters, (IOBase, bytes)): + _content = cache_rule_create_parameters + else: + _content = json.dumps(cache_rule_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cache_rules_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: _models.CacheRule, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Required. + :type cache_rule_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_create_parameters: Union[_models.CacheRule, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Creates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_create_parameters: The parameters for creating a cache rule. Is one of the + following types: CacheRule, JSON, IO[bytes] Required. + :type cache_rule_create_parameters: ~azure.mgmt.containerregistry.models.CacheRule or JSON or + IO[bytes] + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cache_rule_create_parameters=cache_rule_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CacheRule, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CacheRule].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CacheRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(cache_rule_update_parameters, (IOBase, bytes)): + _content = cache_rule_update_parameters + else: + _content = json.dumps(cache_rule_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_cache_rules_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: _models.CacheRuleUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: + ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Required. + :type cache_rule_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + cache_rule_name: str, + cache_rule_update_parameters: Union[_models.CacheRuleUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CacheRule]: + """Updates a cache rule for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :param cache_rule_update_parameters: The parameters for updating a cache rule. Is one of the + following types: CacheRuleUpdateParameters, JSON, IO[bytes] Required. + :type cache_rule_update_parameters: + ~azure.mgmt.containerregistry.models.CacheRuleUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns CacheRule. The CacheRule is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CacheRule] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cache_rule_update_parameters=cache_rule_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CacheRule, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CacheRule].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CacheRule]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_cache_rules_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, cache_rule_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a cache rule resource from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param cache_rule_name: The name of the cache rule. Required. + :type cache_rule_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + cache_rule_name=cache_rule_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.CacheRule"]: + """Lists all cache rule resources for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of CacheRule + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.CacheRule] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CacheRule]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_cache_rules_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CacheRule], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class CredentialSetsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`credential_sets` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> _models.CredentialSet: + """Gets the properties of the specified credential set resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :return: CredentialSet. The CredentialSet is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CredentialSet + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + + _request = build_credential_sets_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CredentialSet, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: Union[_models.CredentialSet, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(credential_set_create_parameters, (IOBase, bytes)): + _content = credential_set_create_parameters + else: + _content = json.dumps(credential_set_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_sets_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: _models.CredentialSet, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. + Required. + :type credential_set_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_create_parameters: Union[_models.CredentialSet, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Creates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_create_parameters: The parameters for creating a credential set. Is one + of the following types: CredentialSet, JSON, IO[bytes] Required. + :type credential_set_create_parameters: ~azure.mgmt.containerregistry.models.CredentialSet or + JSON or IO[bytes] + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + credential_set_create_parameters=credential_set_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CredentialSet, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CredentialSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CredentialSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(credential_set_update_parameters, (IOBase, bytes)): + _content = credential_set_update_parameters + else: + _content = json.dumps(credential_set_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_credential_sets_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: _models.CredentialSetUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: + ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. + Required. + :type credential_set_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + credential_set_name: str, + credential_set_update_parameters: Union[_models.CredentialSetUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.CredentialSet]: + """Updates a credential set for a container registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :param credential_set_update_parameters: The parameters for updating a credential set. Is one + of the following types: CredentialSetUpdateParameters, JSON, IO[bytes] Required. + :type credential_set_update_parameters: + ~azure.mgmt.containerregistry.models.CredentialSetUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns CredentialSet. The CredentialSet is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.CredentialSet] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + credential_set_update_parameters=credential_set_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.CredentialSet, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.CredentialSet].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.CredentialSet]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_credential_sets_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, registry_name: str, credential_set_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a credential set from a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param credential_set_name: The name of the credential set. Required. + :type credential_set_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + credential_set_name=credential_set_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.CredentialSet"]: + """Lists all credential set resources for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of CredentialSet + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.CredentialSet] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.CredentialSet]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_credential_sets_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.CredentialSet], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ConnectedRegistriesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`connected_registries` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: ConnectedRegistry. The ConnectedRegistry is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.ConnectedRegistry + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + + _request = build_connected_registries_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: Union[_models.ConnectedRegistry, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(connected_registry_create_parameters, (IOBase, bytes)): + _content = connected_registry_create_parameters + else: + _content = json.dumps(connected_registry_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connected_registries_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: _models.ConnectedRegistry, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistry + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Required. + :type connected_registry_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_create_parameters: Union[_models.ConnectedRegistry, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_create_parameters: The parameters for creating a connectedRegistry. + Is one of the following types: ConnectedRegistry, JSON, IO[bytes] Required. + :type connected_registry_create_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistry or JSON or IO[bytes] + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedRegistry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedRegistry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(connected_registry_update_parameters, (IOBase, bytes)): + _content = connected_registry_update_parameters + else: + _content = json.dumps(connected_registry_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_connected_registries_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: _models.ConnectedRegistryUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Required. + :type connected_registry_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + connected_registry_name: str, + connected_registry_update_parameters: Union[_models.ConnectedRegistryUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ConnectedRegistry]: + """Updates a connected registry with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :param connected_registry_update_parameters: The parameters for updating a connectedRegistry. + Is one of the following types: ConnectedRegistryUpdateParameters, JSON, IO[bytes] Required. + :type connected_registry_update_parameters: + ~azure.mgmt.containerregistry.models.ConnectedRegistryUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns ConnectedRegistry. The ConnectedRegistry is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ConnectedRegistry] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ConnectedRegistry, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ConnectedRegistry].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ConnectedRegistry]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_connected_registries_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, *, filter: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.ConnectedRegistry"]: + """Lists all connected registries for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :keyword filter: An OData filter expression that describes a subset of connectedRegistries to + return. The parameters that can be filtered are parent.id (the resource id of the + connectedRegistry parent), mode, and connectionState. The supported operator is eq. Default + value is None. + :paramtype filter: str + :return: An iterator like instance of ConnectedRegistry + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.ConnectedRegistry] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ConnectedRegistry]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_connected_registries_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + filter=filter, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ConnectedRegistry], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _deactivate_initial( + self, resource_group_name: str, registry_name: str, connected_registry_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_connected_registries_deactivate_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_deactivate( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param connected_registry_name: The name of the connected registry. Required. + :type connected_registry_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._deactivate_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + connected_registry_name=connected_registry_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`private_endpoint_connections` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: PrivateEndpointConnection. The PrivateEndpointConnection is compatible with + MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.PrivateEndpointConnection + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_endpoint_connection, (IOBase, bytes)): + _content = private_endpoint_connection + else: + _content = json.dumps(private_endpoint_connection, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.models.PrivateEndpointConnection + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Required. + :type private_endpoint_connection: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + registry_name: str, + private_endpoint_connection_name: str, + private_endpoint_connection: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param private_endpoint_connection: The parameters for creating a private endpoint connection. + Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] Required. + :type private_endpoint_connection: + ~azure.mgmt.containerregistry.models.PrivateEndpointConnection or JSON or IO[bytes] + :return: An instance of LROPoller that returns PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PrivateEndpointConnection, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PrivateEndpointConnection]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_private_endpoint_connections_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + private_endpoint_connection_name=private_endpoint_connection_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list( + self, resource_group_name: str, registry_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """List all private endpoint connections in a container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PrivateEndpointConnection]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_private_endpoint_connections_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PrivateEndpointConnection], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ReplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`replications` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :return: Replication. The Replication is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Replication + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + + _request = build_replications_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Replication, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: Union[_models.Replication, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replication, (IOBase, bytes)): + _content = replication + else: + _content = json.dumps(replication, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replications_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: _models.Replication, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: ~azure.mgmt.containerregistry.models.Replication + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Required. + :type replication: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication: Union[_models.Replication, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication: The parameters for creating a replication. Is one of the following types: + Replication, JSON, IO[bytes] Required. + :type replication: ~azure.mgmt.containerregistry.models.Replication or JSON or IO[bytes] + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Replication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Replication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: Union[_models.ReplicationUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(replication_update_parameters, (IOBase, bytes)): + _content = replication_update_parameters + else: + _content = json.dumps(replication_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_replications_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: _models.ReplicationUpdateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Required. + :type replication_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + replication_name: str, + replication_update_parameters: Union[_models.ReplicationUpdateParameters, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :param replication_update_parameters: The parameters for updating a replication. Is one of the + following types: ReplicationUpdateParameters, JSON, IO[bytes] Required. + :type replication_update_parameters: + ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns Replication. The Replication is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Replication] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + replication_update_parameters=replication_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Replication, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Replication].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Replication]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, replication_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_replications_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param replication_name: The name of the replication. Required. + :type replication_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + replication_name=replication_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Replication"]: + """Lists all the replications for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Replication + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Replication] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Replication]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_replications_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Replication], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ScopeMapsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`scope_maps` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :return: ScopeMap. The ScopeMap is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.ScopeMap + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + + _request = build_scope_maps_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ScopeMap, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: Union[_models.ScopeMap, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(scope_map_create_parameters, (IOBase, bytes)): + _content = scope_map_create_parameters + else: + _content = json.dumps(scope_map_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scope_maps_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: _models.ScopeMap, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Required. + :type scope_map_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_create_parameters: Union[_models.ScopeMap, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_create_parameters: The parameters for creating a scope map. Is one of the + following types: ScopeMap, JSON, IO[bytes] Required. + :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ScopeMap, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ScopeMap].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ScopeMap]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(scope_map_update_parameters, (IOBase, bytes)): + _content = scope_map_update_parameters + else: + _content = json.dumps(scope_map_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_scope_maps_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: _models.ScopeMapUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Required. + :type scope_map_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + scope_map_name: str, + scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ScopeMap]: + """Updates a scope map with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :param scope_map_update_parameters: The parameters for updating a scope map. Is one of the + following types: ScopeMapUpdateParameters, JSON, IO[bytes] Required. + :type scope_map_update_parameters: + ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters or JSON or IO[bytes] + :return: An instance of LROPoller that returns ScopeMap. The ScopeMap is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + 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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.ScopeMap, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.ScopeMap].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ScopeMap]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_scope_maps_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param scope_map_name: The name of the scope map. Required. + :type scope_map_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + scope_map_name=scope_map_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.ScopeMap"]: + """Lists all the scope maps for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of ScopeMap + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.ScopeMap] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ScopeMap]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_scope_maps_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ScopeMap], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class TokensOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`tokens` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :return: Token. The Token is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Token + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + + _request = build_tokens_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Token, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: Union[_models.Token, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(token_create_parameters, (IOBase, bytes)): + _content = token_create_parameters + else: + _content = json.dumps(token_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_tokens_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: _models.Token, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Required. + :type token_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_create_parameters: Union[_models.Token, JSON, IO[bytes]], + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_create_parameters: The parameters for creating a token. Is one of the following + types: Token, JSON, IO[bytes] Required. + :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token or JSON or IO[bytes] + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_create_parameters=token_create_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Token, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Token].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Token]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: Union[_models.TokenUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(token_update_parameters, (IOBase, bytes)): + _content = token_update_parameters + else: + _content = json.dumps(token_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_tokens_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: _models.TokenUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Required. + :type token_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + token_name: str, + token_update_parameters: Union[_models.TokenUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Token]: + """Updates a token with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :param token_update_parameters: The parameters for updating a token. Is one of the following + types: TokenUpdateParameters, JSON, IO[bytes] Required. + :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters or + JSON or IO[bytes] + :return: An instance of LROPoller that returns Token. The Token is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Token] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + token_update_parameters=token_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Token, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Token].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Token]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_tokens_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param token_name: The name of the token. Required. + :type token_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + token_name=token_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Token"]: + """Lists all the tokens for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Token + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Token] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Token]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_tokens_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Token], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class WebhooksOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :attr:`webhooks` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: Webhook. The Webhook is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.Webhook + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + + _request = build_webhooks_get_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.Webhook, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: Union[_models.WebhookCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) - models = _models + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(webhook_create_parameters, (IOBase, bytes)): + _content = webhook_create_parameters + else: + _content = json.dumps(webhook_create_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhooks_create_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: _models.WebhookCreateParameters, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: JSON, + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: IO[bytes], + *, + content_type: str = "application/json", + **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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Required. + :type webhook_create_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.OperationDefinition"]: - """List the operations for the provider. + def begin_create( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_create_parameters: Union[_models.WebhookCreateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Webhook]: + """Creates a webhook for a container registry with the specified parameters. - :return: An iterator like instance of either OperationDefinition or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.OperationDefinition] + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_create_parameters: The parameters for creating a webhook. Is one of the + following types: WebhookCreateParameters, JSON, IO[bytes] Required. + :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters + or JSON or IO[bytes] + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._create_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, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Webhook, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Webhook].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Webhook]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(webhook_update_parameters, (IOBase, bytes)): + _content = webhook_update_parameters + else: + _content = json.dumps(webhook_update_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_webhooks_update_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: _models.WebhookUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Required. + :type webhook_update_parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + registry_name: str, + webhook_name: str, + webhook_update_parameters: Union[_models.WebhookUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Webhook]: + """Updates a webhook with the specified parameters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :param webhook_update_parameters: The parameters for updating a webhook. Is one of the + following types: WebhookUpdateParameters, JSON, IO[bytes] Required. + :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters + or JSON or IO[bytes] + :return: An instance of LROPoller that returns Webhook. The Webhook is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + webhook_update_parameters=webhook_update_parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Webhook, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.Webhook].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Webhook]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any + ) -> Iterator[bytes]: + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_webhooks_delete_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # 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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) + lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) + cont_token: Optional[str] = kwargs.pop("continuation_token", None) + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + @distributed_trace + def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Webhook"]: + """Lists all the webhooks for the specified container registry. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :return: An iterator like instance of Webhook + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Webhook] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Webhook]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_webhooks_list_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Webhook], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") or None, iter(list_of_elem) + + def get_next(next_link=None): + _request = prepare_request(next_link) + + _stream = False + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: EventInfo. The EventInfo is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.EventInfo + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.EventInfo] = kwargs.pop("cls", None) + + _request = build_webhooks_ping_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.EventInfo, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_events( + self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any + ) -> ItemPaged["_models.Event"]: + """Lists recent events for the specified webhook. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: An iterator like instance of Event + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Event] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = kwargs.pop("params", {}) or {} - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.Event]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -101,25 +10261,50 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.OperationDefinition"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_webhooks_list_events_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + return _request def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Event], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -132,12 +10317,86 @@ def get_next(next_link=None): 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( + error = _failsafe_deserialize( _models.ErrorResponse, - pipeline_response, + response, ) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + @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. The name is case insensitive. + Required. + :type resource_group_name: str + :param registry_name: The name of the container registry. Required. + :type registry_name: str + :param webhook_name: The name of the webhook. Required. + :type webhook_name: str + :return: CallbackConfig. The CallbackConfig is compatible with MutableMapping + :rtype: ~azure.mgmt.containerregistry.models.CallbackConfig + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.CallbackConfig] = kwargs.pop("cls", None) + + _request = build_webhooks_get_callback_config_request( + resource_group_name=resource_group_name, + registry_name=registry_name, + webhook_name=webhook_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.CallbackConfig, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_patch.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_patch.py index 8bcb627aa475..87676c65a8f0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_patch.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_patch.py @@ -7,9 +7,9 @@ Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 8b7f1e88b37a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,717 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`private_endpoint_connections` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """List all private endpoint connections in a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateEndpointConnectionListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: PrivateEndpointConnection or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.PrivateEndpointConnection - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_endpoint_connection, (IOBase, bytes)): - _content = private_endpoint_connection - else: - _json = self._serialize.body(private_endpoint_connection, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Required. - :type private_endpoint_connection: - ~azure.mgmt.containerregistry.models.PrivateEndpointConnection - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Required. - :type private_endpoint_connection: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - registry_name: str, - private_endpoint_connection_name: str, - private_endpoint_connection: Union[_models.PrivateEndpointConnection, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param private_endpoint_connection: The parameters for creating a private endpoint connection. - Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type private_endpoint_connection: - ~azure.mgmt.containerregistry.models.PrivateEndpointConnection or IO[bytes] - :return: An instance of LROPoller that returns either PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - private_endpoint_connection=private_endpoint_connection, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("PrivateEndpointConnection", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.PrivateEndpointConnection].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.PrivateEndpointConnection]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - private_endpoint_connection_name=private_endpoint_connection_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_registries_operations.py deleted file mode 100644 index ef5ffb513357..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_registries_operations.py +++ /dev/null @@ -1,2439 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_check_name_availability_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerRegistry/checkNameAvailability" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_generate_credentials_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_import_image_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_usages_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_private_link_resources_request( # pylint: disable=name-too-long - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_private_link_resource_request( - resource_group_name: str, registry_name: str, group_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_regenerate_credential_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_build_source_upload_url_request( # pylint: disable=name-too-long - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_schedule_run_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RegistriesOperations: # pylint: disable=too-many-public-methods - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`registries` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @overload - def check_name_availability( - self, - registry_name_check_request: _models.RegistryNameCheckRequest, - *, - content_type: str = "application/json", - **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 request body. Required. - :type registry_name_check_request: - ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def check_name_availability( - self, registry_name_check_request: IO[bytes], *, content_type: str = "application/json", **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 request body. Required. - :type registry_name_check_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def check_name_availability( - self, registry_name_check_request: Union[_models.RegistryNameCheckRequest, IO[bytes]], **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 request body. Is either a RegistryNameCheckRequest type - or a IO[bytes] type. Required. - :type registry_name_check_request: - ~azure.mgmt.containerregistry.models.RegistryNameCheckRequest or IO[bytes] - :return: RegistryNameStatus or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryNameStatus - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegistryNameStatus] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry_name_check_request, (IOBase, bytes)): - _content = registry_name_check_request - else: - _json = self._serialize.body(registry_name_check_request, "RegistryNameCheckRequest") - - _request = build_check_name_availability_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RegistryNameStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.Registry"]: - """Lists all the container registries under the specified subscription. - - :return: An iterator like instance of either Registry or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> ItemPaged["_models.Registry"]: - """Lists all the container registries under the specified resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Registry or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: Registry or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Registry - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Registry", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, resource_group_name: str, registry_name: str, registry: Union[_models.Registry, IO[bytes]], **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry, (IOBase, bytes)): - _content = registry - else: - _json = self._serialize.body(registry, "Registry") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - registry: _models.Registry, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Required. - :type registry: ~azure.mgmt.containerregistry.models.Registry - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - registry: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Required. - :type registry: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, resource_group_name: str, registry_name: str, registry: Union[_models.Registry, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Creates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry: The parameters for creating a container registry. Is either a Registry type or - a IO[bytes] type. Required. - :type registry: ~azure.mgmt.containerregistry.models.Registry or IO[bytes] - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - registry=registry, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Registry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Registry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: Union[_models.RegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(registry_update_parameters, (IOBase, bytes)): - _content = registry_update_parameters - else: - _json = self._serialize.body(registry_update_parameters, "RegistryUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: _models.RegistryUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Required. - :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Required. - :type registry_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - registry_update_parameters: Union[_models.RegistryUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Registry]: - """Updates a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param registry_update_parameters: The parameters for updating a container registry. Is either - a RegistryUpdateParameters type or a IO[bytes] type. Required. - :type registry_update_parameters: ~azure.mgmt.containerregistry.models.RegistryUpdateParameters - or IO[bytes] - :return: An instance of LROPoller that returns either Registry or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Registry] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Registry] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - registry_update_parameters=registry_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Registry", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Registry].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Registry]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _generate_credentials_initial( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(generate_credentials_parameters, (IOBase, bytes)): - _content = generate_credentials_parameters - else: - _json = self._serialize.body(generate_credentials_parameters, "GenerateCredentialsParameters") - - _request = build_generate_credentials_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: _models.GenerateCredentialsParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Required. - :type generate_credentials_parameters: - ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Required. - :type generate_credentials_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_generate_credentials( - self, - resource_group_name: str, - registry_name: str, - generate_credentials_parameters: Union[_models.GenerateCredentialsParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param generate_credentials_parameters: The parameters for generating credentials. Is either a - GenerateCredentialsParameters type or a IO[bytes] type. Required. - :type generate_credentials_parameters: - ~azure.mgmt.containerregistry.models.GenerateCredentialsParameters or IO[bytes] - :return: An instance of LROPoller that returns either GenerateCredentialsResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.GenerateCredentialsResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.GenerateCredentialsResult] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._generate_credentials_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - generate_credentials_parameters=generate_credentials_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("GenerateCredentialsResult", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.GenerateCredentialsResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.GenerateCredentialsResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _import_image_initial( - self, - resource_group_name: str, - registry_name: str, - parameters: Union[_models.ImportImageParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "ImportImageParameters") - - _request = build_import_image_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: _models.ImportImageParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Required. - :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @overload - def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :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: - """ - - @distributed_trace - def begin_import_image( - self, - resource_group_name: str, - registry_name: str, - parameters: Union[_models.ImportImageParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param parameters: The parameters specifying the image to copy and the source container - registry. Is either a ImportImageParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerregistry.models.ImportImageParameters or IO[bytes] - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._import_image_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RegistryListCredentialsResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: RegistryUsageListResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryUsageListResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.RegistryUsageListResult] = kwargs.pop("cls", None) - - _request = build_list_usages_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RegistryUsageListResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_private_link_resources( - self, resource_group_name: str, registry_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateLinkResource"]: - """Lists the private link resources for a container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.PrivateLinkResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateLinkResourceListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_private_link_resources_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param group_name: The name of the private link associated with the Azure resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.PrivateLinkResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_private_link_resource_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - group_name=group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("PrivateLinkResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: _models.RegenerateCredentialParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Required. - :type regenerate_credential_parameters: - ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Required. - :type regenerate_credential_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def regenerate_credential( - self, - resource_group_name: str, - registry_name: str, - regenerate_credential_parameters: Union[_models.RegenerateCredentialParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param regenerate_credential_parameters: Specifies name of the password which should be - regenerated -- password or password2. Is either a RegenerateCredentialParameters type or a - IO[bytes] type. Required. - :type regenerate_credential_parameters: - ~azure.mgmt.containerregistry.models.RegenerateCredentialParameters or IO[bytes] - :return: RegistryListCredentialsResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RegistryListCredentialsResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.RegistryListCredentialsResult] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(regenerate_credential_parameters, (IOBase, bytes)): - _content = regenerate_credential_parameters - else: - _json = self._serialize.body(regenerate_credential_parameters, "RegenerateCredentialParameters") - - _request = build_regenerate_credential_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RegistryListCredentialsResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_build_source_upload_url( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: SourceUploadDefinition or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.SourceUploadDefinition - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.SourceUploadDefinition] = kwargs.pop("cls", None) - - _request = build_get_build_source_upload_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("SourceUploadDefinition", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: _models.RunRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Required. - :type run_request: ~azure.mgmt.containerregistry.models.RunRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Required. - :type run_request: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def schedule_run( - self, - resource_group_name: str, - registry_name: str, - run_request: Union[_models.RunRequest, IO[bytes]], - **kwargs: Any - ) -> _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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param run_request: The request body. Is either a RunRequest type or a IO[bytes] type. - Required. - :type run_request: ~azure.mgmt.containerregistry.models.RunRequest or IO[bytes] - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_request, (IOBase, bytes)): - _content = run_request - else: - _json = self._serialize.body(run_request, "RunRequest") - - _request = build_schedule_run_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_replications_operations.py deleted file mode 100644 index 9e210f2d3644..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_replications_operations.py +++ /dev/null @@ -1,951 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, replication_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ReplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`replications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Replication"]: - """Lists all the replications for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Replication or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ReplicationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :return: Replication or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Replication - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Replication", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: Union[_models.Replication, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replication, (IOBase, bytes)): - _content = replication - else: - _json = self._serialize.body(replication, "Replication") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: _models.Replication, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Required. - :type replication: ~azure.mgmt.containerregistry.models.Replication - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Required. - :type replication: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication: Union[_models.Replication, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication: The parameters for creating a replication. Is either a Replication type or - a IO[bytes] type. Required. - :type replication: ~azure.mgmt.containerregistry.models.Replication or IO[bytes] - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - replication=replication, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Replication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Replication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: Union[_models.ReplicationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(replication_update_parameters, (IOBase, bytes)): - _content = replication_update_parameters - else: - _json = self._serialize.body(replication_update_parameters, "ReplicationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: _models.ReplicationUpdateParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Required. - :type replication_update_parameters: - ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Required. - :type replication_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - replication_name: str, - replication_update_parameters: Union[_models.ReplicationUpdateParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :param replication_update_parameters: The parameters for updating a replication. Is either a - ReplicationUpdateParameters type or a IO[bytes] type. Required. - :type replication_update_parameters: - ~azure.mgmt.containerregistry.models.ReplicationUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either Replication or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Replication] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Replication] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - replication_update_parameters=replication_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Replication", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Replication].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Replication]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, replication_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param replication_name: The name of the replication. Required. - :type replication_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - replication_name=replication_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_runs_operations.py deleted file mode 100644 index b23d19b3b320..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_runs_operations.py +++ /dev/null @@ -1,673 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, - registry_name: str, - subscription_id: str, - *, - filter: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if filter is not None: - _params["$filter"] = _SERIALIZER.query("filter", filter, "str") - if top is not None: - _params["$top"] = _SERIALIZER.query("top", top, "int") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, run_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, run_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_cancel_request( - resource_group_name: str, registry_name: str, run_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_log_sas_url_request( - resource_group_name: str, registry_name: str, run_id: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class RunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, - resource_group_name: str, - registry_name: str, - filter: Optional[str] = None, - top: Optional[int] = None, - **kwargs: Any - ) -> ItemPaged["_models.Run"]: - """Gets all the runs for a registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param filter: The runs filter to apply on the operation. Arithmetic operators are not - supported. The allowed string function is 'contains'. All logical operators except 'Not', - 'Has', 'All' are allowed. Default value is None. - :type filter: str - :param top: $top is supported for get list of runs, which limits the maximum number of runs to - return. Default value is None. - :type top: int - :return: An iterator like instance of either Run or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Run] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.RunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - filter=filter, - top=top, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("RunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: _models.RunUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Required. - :type run_update_parameters: ~azure.mgmt.containerregistry.models.RunUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Required. - :type run_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - registry_name: str, - run_id: str, - run_update_parameters: Union[_models.RunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Run: - """Patch the run properties. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :param run_update_parameters: The run update properties. Is either a RunUpdateParameters type - or a IO[bytes] type. Required. - :type run_update_parameters: ~azure.mgmt.containerregistry.models.RunUpdateParameters or - IO[bytes] - :return: Run or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Run - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Run] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(run_update_parameters, (IOBase, bytes)): - _content = run_update_parameters - else: - _json = self._serialize.body(run_update_parameters, "RunUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Run", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def cancel( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, run_id: str, **kwargs: Any - ) -> None: - """Cancel an existing run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_cancel_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_log_sas_url( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param run_id: The run ID. Required. - :type run_id: str - :return: RunGetLogResult or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.RunGetLogResult - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.RunGetLogResult] = kwargs.pop("cls", None) - - _request = build_get_log_sas_url_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - run_id=run_id, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("RunGetLogResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_scope_maps_operations.py deleted file mode 100644 index 5bf5fbf9a99b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_scope_maps_operations.py +++ /dev/null @@ -1,943 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, scope_map_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ScopeMapsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`scope_maps` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.ScopeMap"]: - """Lists all the scope maps for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either ScopeMap or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ScopeMapListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ScopeMapListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :return: ScopeMap or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.ScopeMap - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ScopeMap", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: Union[_models.ScopeMap, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(scope_map_create_parameters, (IOBase, bytes)): - _content = scope_map_create_parameters - else: - _json = self._serialize.body(scope_map_create_parameters, "ScopeMap") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: _models.ScopeMap, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Required. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Required. - :type scope_map_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_create_parameters: Union[_models.ScopeMap, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_create_parameters: The parameters for creating a scope map. Is either a - ScopeMap type or a IO[bytes] type. Required. - :type scope_map_create_parameters: ~azure.mgmt.containerregistry.models.ScopeMap or IO[bytes] - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - scope_map_create_parameters=scope_map_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopeMap", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ScopeMap].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ScopeMap]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(scope_map_update_parameters, (IOBase, bytes)): - _content = scope_map_update_parameters - else: - _json = self._serialize.body(scope_map_update_parameters, "ScopeMapUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: _models.ScopeMapUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Required. - :type scope_map_update_parameters: - ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Required. - :type scope_map_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - scope_map_name: str, - scope_map_update_parameters: Union[_models.ScopeMapUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ScopeMap]: - """Updates a scope map with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :param scope_map_update_parameters: The parameters for updating a scope map. Is either a - ScopeMapUpdateParameters type or a IO[bytes] type. Required. - :type scope_map_update_parameters: - ~azure.mgmt.containerregistry.models.ScopeMapUpdateParameters or IO[bytes] - :return: An instance of LROPoller that returns either ScopeMap or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.ScopeMap] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ScopeMap] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - scope_map_update_parameters=scope_map_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("ScopeMap", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.ScopeMap].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ScopeMap]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, scope_map_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param scope_map_name: The name of the scope map. Required. - :type scope_map_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - scope_map_name=scope_map_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_task_runs_operations.py deleted file mode 100644 index 35e119252173..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_task_runs_operations.py +++ /dev/null @@ -1,984 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, task_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, task_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, task_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, task_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_details_request( - resource_group_name: str, registry_name: str, task_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class TaskRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`task_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.TaskRun"]: - """Lists all the task runs for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either TaskRun or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("TaskRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: TaskRun or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.TaskRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: Union[_models.TaskRun, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_run, (IOBase, bytes)): - _content = task_run - else: - _json = self._serialize.body(task_run, "TaskRun") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: _models.TaskRun, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Required. - :type task_run: ~azure.mgmt.containerregistry.models.TaskRun - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Required. - :type task_run: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - task_run: Union[_models.TaskRun, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param task_run: The parameters of a run that needs to scheduled. Is either a TaskRun type or a - IO[bytes] type. Required. - :type task_run: ~azure.mgmt.containerregistry.models.TaskRun or IO[bytes] - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - task_run=task_run, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.TaskRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.TaskRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: Union[_models.TaskRunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(update_parameters, (IOBase, bytes)): - _content = update_parameters - else: - _json = self._serialize.body(update_parameters, "TaskRunUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: _models.TaskRunUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.TaskRunUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Required. - :type update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - task_run_name: str, - update_parameters: Union[_models.TaskRunUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.TaskRun]: - """Updates a task run with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :param update_parameters: The parameters for updating a task run. Is either a - TaskRunUpdateParameters type or a IO[bytes] type. Required. - :type update_parameters: ~azure.mgmt.containerregistry.models.TaskRunUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either TaskRun or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.TaskRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - update_parameters=update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.TaskRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.TaskRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, task_run_name: str, **kwargs: Any - ) -> None: - """Deletes a specified task run resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_details( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_run_name: The name of the task run. Required. - :type task_run_name: str - :return: TaskRun or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.TaskRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskRun] = kwargs.pop("cls", None) - - _request = build_get_details_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_run_name=task_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("TaskRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tasks_operations.py deleted file mode 100644 index fba434110bd1..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tasks_operations.py +++ /dev/null @@ -1,838 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Optional, TypeVar, Union, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_details_request( - resource_group_name: str, registry_name: str, task_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class TasksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`tasks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Task"]: - """Lists all the tasks for a specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :return: An iterator like instance of either Task or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Task] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.TaskListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("TaskListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: _models.Task, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Required. - :type task_create_parameters: ~azure.mgmt.containerregistry.models.Task - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Required. - :type task_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_create_parameters: Union[_models.Task, IO[bytes]], - **kwargs: Any - ) -> _models.Task: - """Creates a task for a container registry with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_create_parameters: The parameters for creating a task. Is either a Task type or a - IO[bytes] type. Required. - :type task_create_parameters: ~azure.mgmt.containerregistry.models.Task or IO[bytes] - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_create_parameters, (IOBase, bytes)): - _content = task_create_parameters - else: - _json = self._serialize.body(task_create_parameters, "Task") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: _models.TaskUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Required. - :type task_update_parameters: ~azure.mgmt.containerregistry.models.TaskUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Required. - :type task_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - registry_name: str, - task_name: str, - task_update_parameters: Union[_models.TaskUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.Task: - """Updates a task with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :param task_update_parameters: The parameters for updating a task. Is either a - TaskUpdateParameters type or a IO[bytes] type. Required. - :type task_update_parameters: ~azure.mgmt.containerregistry.models.TaskUpdateParameters or - IO[bytes] - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(task_update_parameters, (IOBase, bytes)): - _content = task_update_parameters - else: - _json = self._serialize.body(task_update_parameters, "TaskUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, registry_name: str, task_name: str, **kwargs: Any - ) -> None: - """Deletes a specified task. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - @distributed_trace - def get_details(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the Registry. Required. - :type registry_name: str - :param task_name: The name of the container registry task. Required. - :type task_name: str - :return: Task or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Task - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) - cls: ClsType[_models.Task] = kwargs.pop("cls", None) - - _request = build_get_details_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - task_name=task_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Task", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tokens_operations.py deleted file mode 100644 index f5b2542ded0f..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_tokens_operations.py +++ /dev/null @@ -1,942 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# 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 collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, token_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class TokensOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`tokens` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Token"]: - """Lists all the tokens for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Token or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.TokenListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("TokenListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :return: Token or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Token - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Token", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: Union[_models.Token, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(token_create_parameters, (IOBase, bytes)): - _content = token_create_parameters - else: - _json = self._serialize.body(token_create_parameters, "Token") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: _models.Token, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Required. - :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Required. - :type token_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_create_parameters: Union[_models.Token, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_create_parameters: The parameters for creating a token. Is either a Token type or - a IO[bytes] type. Required. - :type token_create_parameters: ~azure.mgmt.containerregistry.models.Token or IO[bytes] - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - token_create_parameters=token_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Token", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Token].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Token]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: Union[_models.TokenUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(token_update_parameters, (IOBase, bytes)): - _content = token_update_parameters - else: - _json = self._serialize.body(token_update_parameters, "TokenUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: _models.TokenUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Required. - :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Required. - :type token_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - token_name: str, - token_update_parameters: Union[_models.TokenUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Token]: - """Updates a token with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :param token_update_parameters: The parameters for updating a token. Is either a - TokenUpdateParameters type or a IO[bytes] type. Required. - :type token_update_parameters: ~azure.mgmt.containerregistry.models.TokenUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either Token or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Token] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Token] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - token_update_parameters=token_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Token", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Token].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Token]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, token_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param token_name: The name of the token. Required. - :type token_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - token_name=token_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_webhooks_operations.py deleted file mode 100644 index 6338d23d9ac2..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_webhooks_operations.py +++ /dev/null @@ -1,1262 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression,too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from collections.abc import MutableMapping -from io import IOBase -from typing import Any, Callable, IO, Iterator, Optional, TypeVar, Union, cast, overload - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from .._configuration import ContainerRegistryManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, dict[str, Any]], Any]] -List = list - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request( - resource_group_name: str, registry_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, min_length=1 - ), - "registryName": _SERIALIZER.url( - "registry_name", registry_name, "str", max_length=50, min_length=5, pattern=r"^[a-zA-Z0-9]*$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_callback_config_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_events_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_ping_request( - resource_group_name: str, registry_name: str, webhook_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - accept = _headers.pop("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", max_length=90, 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: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class WebhooksOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s - :attr:`webhooks` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryManagementClientConfiguration = ( - input_args.pop(0) if input_args else kwargs.pop("config") - ) - self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, resource_group_name: str, registry_name: str, **kwargs: Any) -> ItemPaged["_models.Webhook"]: - """Lists all the webhooks for the specified container registry. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :return: An iterator like instance of either Webhook or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.WebhookListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: Webhook or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.Webhook - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Webhook", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: Union[_models.WebhookCreateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(webhook_create_parameters, (IOBase, bytes)): - _content = webhook_create_parameters - else: - _json = self._serialize.body(webhook_create_parameters, "WebhookCreateParameters") - - _request = build_create_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: _models.WebhookCreateParameters, - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Required. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: IO[bytes], - *, - content_type: str = "application/json", - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Required. - :type webhook_create_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_create_parameters: Union[_models.WebhookCreateParameters, IO[bytes]], - **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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_create_parameters: The parameters for creating a webhook. Is either a - WebhookCreateParameters type or a IO[bytes] type. Required. - :type webhook_create_parameters: ~azure.mgmt.containerregistry.models.WebhookCreateParameters - or IO[bytes] - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - webhook_create_parameters=webhook_create_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Webhook", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Webhook].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Webhook]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(webhook_update_parameters, (IOBase, bytes)): - _content = webhook_update_parameters - else: - _json = self._serialize.body(webhook_update_parameters, "WebhookUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: _models.WebhookUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Required. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Required. - :type webhook_update_parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - registry_name: str, - webhook_name: str, - webhook_update_parameters: Union[_models.WebhookUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.Webhook]: - """Updates a webhook with the specified parameters. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :param webhook_update_parameters: The parameters for updating a webhook. Is either a - WebhookUpdateParameters type or a IO[bytes] type. Required. - :type webhook_update_parameters: ~azure.mgmt.containerregistry.models.WebhookUpdateParameters - or IO[bytes] - :return: An instance of LROPoller that returns either Webhook or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerregistry.models.Webhook] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Webhook] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - webhook_update_parameters=webhook_update_parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Webhook", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Webhook].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Webhook]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # 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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: CallbackConfig or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.CallbackConfig - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.CallbackConfig] = kwargs.pop("cls", None) - - _request = build_get_callback_config_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("CallbackConfig", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_events( - self, resource_group_name: str, registry_name: str, webhook_name: str, **kwargs: Any - ) -> ItemPaged["_models.Event"]: - """Lists recent events for the specified webhook. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: An iterator like instance of either Event or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerregistry.models.Event] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.EventListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_events_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - _request = HttpRequest("GET", next_link) - _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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @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. The name is case insensitive. - Required. - :type resource_group_name: str - :param registry_name: The name of the container registry. Required. - :type registry_name: str - :param webhook_name: The name of the webhook. Required. - :type webhook_name: str - :return: EventInfo or the result of cls(response) - :rtype: ~azure.mgmt.containerregistry.models.EventInfo - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-11-01")) - cls: ClsType[_models.EventInfo] = kwargs.pop("cls", None) - - _request = build_ping_request( - resource_group_name=resource_group_name, - registry_name=registry_name, - webhook_name=webhook_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize( - _models.ErrorResponse, - pipeline_response, - ) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("EventInfo", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_create.py deleted file mode 100644 index a74d8ab536f0..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_create.py +++ /dev/null @@ -1,49 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.agent_pools.begin_create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - agent_pool_name="myAgentPool", - agent_pool={ - "location": "WESTUS", - "properties": {"count": 1, "os": "Linux", "tier": "S1"}, - "tags": {"key": "value"}, - }, - ).result() - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_delete.py deleted file mode 100644 index 81779471ac16..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - client.agent_pools.begin_delete( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - agent_pool_name="myAgentPool", - ).result() - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get.py deleted file mode 100644 index 321975cb05d8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.agent_pools.get( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - agent_pool_name="myAgentPool", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get_queue_status.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get_queue_status.py deleted file mode 100644 index 2313d6618e8d..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_get_queue_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_get_queue_status.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.agent_pools.get_queue_status( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - agent_pool_name="myAgentPool", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsGetQueueStatus.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_list.py deleted file mode 100644 index fb03fe2b345e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.agent_pools.list( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsList.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_update.py deleted file mode 100644 index 427668f77b2b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/agent_pools_update.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python agent_pools_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.agent_pools.begin_update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - agent_pool_name="myAgentPool", - update_parameters={"properties": {"count": 1}}, - ).result() - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/AgentPoolsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py index e3bd6ced5bb4..2ae608351340 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cache_rules.begin_create( @@ -46,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CacheRuleCreate.json +# x-ms-original-file: 2025-11-01/CacheRuleCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py index 8b66e6a177dd..2784f3aee5a4 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.cache_rules.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CacheRuleDelete.json +# x-ms-original-file: 2025-11-01/CacheRuleDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py index 3217b5371fac..e7a0bdac84fc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cache_rules.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CacheRuleGet.json +# x-ms-original-file: 2025-11-01/CacheRuleGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py index 1d0c89927a78..6f5e968584a3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cache_rules.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CacheRuleList.json +# x-ms-original-file: 2025-11-01/CacheRuleList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py index 4042eceb8718..d8201ca17e7a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.cache_rules.begin_update( @@ -44,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CacheRuleUpdate.json +# x-ms-original-file: 2025-11-01/CacheRuleUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py index 042900eff9b7..5f28ebb464db 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.connected_registries.begin_create( @@ -57,6 +57,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryCreate.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py index a2f9c6f2f2d4..bccd2d4bd4dc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.connected_registries.begin_deactivate( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryDeactivate.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryDeactivate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py index 5913279c7679..0ef3ede01326 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.connected_registries.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryDelete.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py index 55308b7c12d6..462d66327fcc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.connected_registries.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryGet.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py index 75e14548caa1..ce113819898b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.connected_registries.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryList.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py index 7dd3bfc74151..0b564e647130 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.connected_registries.begin_update( @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ConnectedRegistryUpdate.json +# x-ms-original-file: 2025-11-01/ConnectedRegistryUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py index 91445274d574..dac2e54e2144 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential_sets.begin_create( @@ -52,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CredentialSetCreate.json +# x-ms-original-file: 2025-11-01/CredentialSetCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py index e96ed12c129f..7dbefe953aff 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.credential_sets.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CredentialSetDelete.json +# x-ms-original-file: 2025-11-01/CredentialSetDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py index c59f60d27c6c..ed676ac4589f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential_sets.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CredentialSetGet.json +# x-ms-original-file: 2025-11-01/CredentialSetGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py index 44ed92f0ac7b..a41f18add635 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential_sets.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CredentialSetList.json +# x-ms-original-file: 2025-11-01/CredentialSetList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py index da9831e29ead..b61dcf16a572 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.credential_sets.begin_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/CredentialSetUpdate.json +# x-ms-original-file: 2025-11-01/CredentialSetUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py index 1cefd37dbef8..4d3bdc6e5109 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.registries.begin_import_image( @@ -46,6 +46,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ImportImageByManifestDigest.json +# x-ms-original-file: 2025-11-01/ImportImageByManifestDigest.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py index f9f15ea63809..6b77c55b7670 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.registries.begin_import_image( @@ -46,6 +46,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ImportImageByTag.json +# x-ms-original-file: 2025-11-01/ImportImageByTag.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py index 886e87cdc8a5..b57cf98d72a3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.registries.begin_import_image( @@ -43,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ImportImageFromPublicRegistry.json +# x-ms-original-file: 2025-11-01/ImportImageFromPublicRegistry.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_login_identity.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_login_identity.py deleted file mode 100644 index a23e1b603a6c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_login_identity.py +++ /dev/null @@ -1,85 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create_with_login_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="mytTask", - task_create_parameters={ - "identity": {"type": "SystemAssigned"}, - "location": "eastus", - "properties": { - "agentConfiguration": {"cpu": 2}, - "credentials": {"sourceRegistry": {"identity": "[system]"}}, - "isSystemTask": False, - "logTemplate": None, - "platform": {"architecture": "amd64", "os": "Linux"}, - "status": "Enabled", - "step": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "contextPath": "src", - "dockerFilePath": "src/DockerFile", - "imageNames": ["azurerest:testtag"], - "isPushEnabled": True, - "noCache": False, - "type": "Docker", - }, - "trigger": { - "baseImageTrigger": {"baseImageTriggerType": "Runtime", "name": "myBaseImageTrigger"}, - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": { - "branch": "master", - "repositoryUrl": "https://github.com/Azure/azure-rest-api-specs", - "sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}, - "sourceControlType": "Github", - }, - "sourceTriggerEvents": ["commit"], - } - ], - "timerTriggers": [{"name": "myTimerTrigger", "schedule": "30 9 * * 1-5"}], - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksCreate_WithLoginIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_and_user_identities.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_and_user_identities.py deleted file mode 100644 index 529ec84840ea..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_and_user_identities.py +++ /dev/null @@ -1,94 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create_with_system_and_user_identities.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="mytTask", - task_create_parameters={ - "identity": { - "type": "SystemAssigned, UserAssigned", - "userAssignedIdentities": { - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {} - }, - }, - "location": "eastus", - "properties": { - "agentConfiguration": {"cpu": 2}, - "isSystemTask": False, - "logTemplate": None, - "platform": {"architecture": "amd64", "os": "Linux"}, - "status": "Enabled", - "step": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "contextPath": "src", - "dockerFilePath": "src/DockerFile", - "imageNames": ["azurerest:testtag"], - "isPushEnabled": True, - "noCache": False, - "type": "Docker", - }, - "trigger": { - "baseImageTrigger": { - "baseImageTriggerType": "Runtime", - "name": "myBaseImageTrigger", - "updateTriggerEndpoint": "https://user:pass@mycicd.webhook.com?token=foo", - "updateTriggerPayloadType": "Default", - }, - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": { - "branch": "master", - "repositoryUrl": "https://github.com/Azure/azure-rest-api-specs", - "sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}, - "sourceControlType": "Github", - }, - "sourceTriggerEvents": ["commit"], - } - ], - "timerTriggers": [{"name": "myTimerTrigger", "schedule": "30 9 * * 1-5"}], - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemAndUserIdentities.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_identity.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_identity.py deleted file mode 100644 index 77b235b0f12d..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_system_identity.py +++ /dev/null @@ -1,84 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create_with_system_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="mytTask", - task_create_parameters={ - "identity": {"type": "SystemAssigned"}, - "location": "eastus", - "properties": { - "agentConfiguration": {"cpu": 2}, - "isSystemTask": False, - "logTemplate": None, - "platform": {"architecture": "amd64", "os": "Linux"}, - "status": "Enabled", - "step": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "contextPath": "src", - "dockerFilePath": "src/DockerFile", - "imageNames": ["azurerest:testtag"], - "isPushEnabled": True, - "noCache": False, - "type": "Docker", - }, - "trigger": { - "baseImageTrigger": {"baseImageTriggerType": "Runtime", "name": "myBaseImageTrigger"}, - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": { - "branch": "master", - "repositoryUrl": "https://github.com/Azure/azure-rest-api-specs", - "sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}, - "sourceControlType": "Github", - }, - "sourceTriggerEvents": ["commit"], - } - ], - "timerTriggers": [{"name": "myTimerTrigger", "schedule": "30 9 * * 1-5"}], - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksCreate_WithSystemIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_user_identities.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_user_identities.py deleted file mode 100644 index d52dde851336..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_create_with_user_identities.py +++ /dev/null @@ -1,95 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create_with_user_identities.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="mytTask", - task_create_parameters={ - "identity": { - "type": "UserAssigned", - "userAssignedIdentities": { - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity1": {}, - "/subscriptions/f9d7ebed-adbd-4cb4-b973-aaf82c136138/resourcegroups/myResourceGroup1/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity2": {}, - }, - }, - "location": "eastus", - "properties": { - "agentConfiguration": {"cpu": 2}, - "isSystemTask": False, - "logTemplate": None, - "platform": {"architecture": "amd64", "os": "Linux"}, - "status": "Enabled", - "step": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "contextPath": "src", - "dockerFilePath": "src/DockerFile", - "imageNames": ["azurerest:testtag"], - "isPushEnabled": True, - "noCache": False, - "type": "Docker", - }, - "trigger": { - "baseImageTrigger": { - "baseImageTriggerType": "Runtime", - "name": "myBaseImageTrigger", - "updateTriggerEndpoint": "https://user:pass@mycicd.webhook.com?token=foo", - "updateTriggerPayloadType": "Default", - }, - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": { - "branch": "master", - "repositoryUrl": "https://github.com/Azure/azure-rest-api-specs", - "sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}, - "sourceControlType": "Github", - }, - "sourceTriggerEvents": ["commit"], - } - ], - "timerTriggers": [{"name": "myTimerTrigger", "schedule": "30 9 * * 1-5"}], - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksCreate_WithUserIdentities.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_key_vault_custom_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_key_vault_custom_credentials.py deleted file mode 100644 index fb9ba63809b3..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_key_vault_custom_credentials.py +++ /dev/null @@ -1,77 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update_with_key_vault_custom_credentials.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - task_update_parameters={ - "properties": { - "agentConfiguration": {"cpu": 3}, - "credentials": { - "customRegistries": { - "myregistry.azurecr.io": { - "identity": "[system]", - "password": { - "type": "Vaultsecret", - "value": "https://myacbvault.vault.azure.net/secrets/password", - }, - "userName": { - "type": "Vaultsecret", - "value": "https://myacbvault.vault.azure.net/secrets/username", - }, - } - } - }, - "logTemplate": None, - "status": "Enabled", - "step": {"dockerFilePath": "src/DockerFile", "imageNames": ["azurerest:testtag1"], "type": "Docker"}, - "trigger": { - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": {"sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}}, - "sourceTriggerEvents": ["commit"], - } - ] - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksUpdate_WithKeyVaultCustomCredentials.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_login_identity.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_login_identity.py deleted file mode 100644 index 35b42f3a612b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_login_identity.py +++ /dev/null @@ -1,63 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update_with_login_identity.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - task_update_parameters={ - "properties": { - "agentConfiguration": {"cpu": 3}, - "credentials": {"sourceRegistry": {"identity": "[system]"}}, - "logTemplate": None, - "status": "Enabled", - "step": {"dockerFilePath": "src/DockerFile", "imageNames": ["azurerest:testtag1"], "type": "Docker"}, - "trigger": { - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": {"sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}}, - "sourceTriggerEvents": ["commit"], - } - ] - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksUpdate_WithLoginIdentity.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_msi_custom_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_msi_custom_credentials.py deleted file mode 100644 index 4f4e158740f8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/managed_identity/tasks_update_with_msi_custom_credentials.py +++ /dev/null @@ -1,63 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update_with_msi_custom_credentials.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - task_update_parameters={ - "properties": { - "agentConfiguration": {"cpu": 3}, - "credentials": {"customRegistries": {"myregistry.azurecr.io": {"identity": "[system]"}}}, - "logTemplate": None, - "status": "Enabled", - "step": {"dockerFilePath": "src/DockerFile", "imageNames": ["azurerest:testtag1"], "type": "Docker"}, - "trigger": { - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": {"sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}}, - "sourceTriggerEvents": ["commit"], - } - ] - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/ManagedIdentity/TasksUpdate_WithMSICustomCredentials.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py index 8bb8f0df193c..9e3fcdd91172 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,7 +25,7 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/OperationList.json +# x-ms-original-file: 2025-11-01/OperationList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py index 56c522436bfa..3b86255a56ec 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.begin_create_or_update( @@ -42,6 +41,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/PrivateEndpointConnectionCreateOrUpdate.json +# x-ms-original-file: 2025-11-01/PrivateEndpointConnectionCreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py index 82dcfa4c607d..b8359f6deb5e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.private_endpoint_connections.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/PrivateEndpointConnectionDelete.json +# x-ms-original-file: 2025-11-01/PrivateEndpointConnectionDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py index f8d2db6c38d7..5c2eb2af5906 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/PrivateEndpointConnectionGet.json +# x-ms-original-file: 2025-11-01/PrivateEndpointConnectionGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py index f28d5c49e80b..fab4cd1e744d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/PrivateEndpointConnectionList.json +# x-ms-original-file: 2025-11-01/PrivateEndpointConnectionList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_get_build_source_upload_url.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_get_build_source_upload_url.py deleted file mode 100644 index 519190c564e3..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_get_build_source_upload_url.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_get_build_source_upload_url.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.get_build_source_upload_url( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesGetBuildSourceUploadUrl.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run.py deleted file mode 100644 index 970fabd1df30..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "agentConfiguration": {"cpu": 2}, - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "dockerFilePath": "DockerFile", - "imageNames": ["azurerest:testtag"], - "isArchiveEnabled": True, - "isPushEnabled": True, - "noCache": True, - "platform": {"architecture": "amd64", "os": "Linux"}, - "sourceLocation": "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D", - "type": "DockerBuildRequest", - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_encoded_task_run.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_encoded_task_run.py deleted file mode 100644 index 916a198e3ade..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_encoded_task_run.py +++ /dev/null @@ -1,54 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_encoded_task_run.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "agentConfiguration": {"cpu": 2}, - "encodedTaskContent": "c3RlcHM6Cnt7IGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAncHJvZCcgfX0KICAtIHJ1bjogcHJvZCBzZXR1cAp7eyBlbHNlIGlmIFZhbHVlcy5lbnZpcm9ubWVudCA9PSAnc3RhZ2luZycgfX0KICAtIHJ1bjogc3RhZ2luZyBzZXR1cAp7eyBlbHNlIH19CiAgLSBydW46IGRlZmF1bHQgc2V0dXAKe3sgZW5kIH19CgogIC0gcnVuOiBidWlsZCAtdCBGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0gLgoKcHVzaDogWydGYW5jeVRoaW5nOnt7LlZhbHVlcy5lbnZpcm9ubWVudH19LXt7LlZhbHVlcy52ZXJzaW9ufX0nXQ==", - "encodedValuesContent": "ZW52aXJvbm1lbnQ6IHByb2QKdmVyc2lvbjogMQ==", - "platform": {"os": "Linux"}, - "type": "EncodedTaskRunRequest", - "values": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_EncodedTaskRun.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_run.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_run.py deleted file mode 100644 index 47aba4562a9a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_run.py +++ /dev/null @@ -1,55 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_file_task_run.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "agentConfiguration": {"cpu": 2}, - "platform": {"os": "Linux"}, - "sourceLocation": "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D", - "taskFilePath": "acb.yaml", - "type": "FileTaskRunRequest", - "values": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "valuesFilePath": "prod-values.yaml", - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_FileTaskRun.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_with_custom_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_with_custom_credentials.py deleted file mode 100644 index b5f25f28f723..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_file_task_with_custom_credentials.py +++ /dev/null @@ -1,61 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_file_task_with_custom_credentials.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "credentials": { - "customRegistries": { - "myregistry.azurecr.io": { - "password": {"type": "Opaque", "value": "***"}, - "userName": {"type": "Opaque", "value": "reg1"}, - } - }, - "sourceRegistry": {"loginMode": "Default"}, - }, - "platform": {"os": "Linux"}, - "taskFilePath": "acb.yaml", - "type": "FileTaskRunRequest", - "values": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_FileTask_WithCustomCredentials.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_task.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_task.py deleted file mode 100644 index d42e94da078e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_task.py +++ /dev/null @@ -1,60 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_task.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "overrideTaskStepProperties": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "file": "overriddenDockerfile", - "target": "build", - "updateTriggerToken": "aGVsbG8gd29ybGQ=", - "values": [ - {"isSecret": False, "name": "mytestname", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestname", "value": "mysecrettestvalue"}, - ], - }, - "taskId": "myTask", - "type": "TaskRunRequest", - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_Task.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_custom_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_custom_credentials.py deleted file mode 100644 index cf82ccab7f42..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_custom_credentials.py +++ /dev/null @@ -1,72 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_with_custom_credentials.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "agentConfiguration": {"cpu": 2}, - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "credentials": { - "customRegistries": { - "myregistry.azurecr.io": { - "password": {"type": "Opaque", "value": "***"}, - "userName": {"type": "Opaque", "value": "reg1"}, - }, - "myregistry2.azurecr.io": { - "password": {"type": "Opaque", "value": "***"}, - "userName": {"type": "Opaque", "value": "reg2"}, - }, - }, - "sourceRegistry": {"loginMode": "Default"}, - }, - "dockerFilePath": "DockerFile", - "imageNames": ["azurerest:testtag"], - "isArchiveEnabled": True, - "isPushEnabled": True, - "noCache": True, - "platform": {"architecture": "amd64", "os": "Linux"}, - "sourceLocation": "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D", - "target": "stage1", - "type": "DockerBuildRequest", - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_WithCustomCredentials.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_log_template.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_log_template.py deleted file mode 100644 index 22b340af3080..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registries_schedule_run_with_log_template.py +++ /dev/null @@ -1,59 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python registries_schedule_run_with_log_template.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.registries.schedule_run( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_request={ - "agentConfiguration": {"cpu": 2}, - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "dockerFilePath": "DockerFile", - "imageNames": ["azurerest:testtag"], - "isArchiveEnabled": True, - "isPushEnabled": True, - "logTemplate": "acr/tasks:{{.Run.OS}}", - "noCache": True, - "platform": {"architecture": "amd64", "os": "Linux"}, - "sourceLocation": "https://myaccount.blob.core.windows.net/sascontainer/source.zip?sv=2015-04-05&st=2015-04-29T22%3A18%3A26Z&se=2015-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=Z%2FRHIX5Xcg0Mq2rqI3OlWTjEg2tYkboXr1P9ZUXDtkk%3D", - "type": "DockerBuildRequest", - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RegistriesScheduleRun_WithLogTemplate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py index b4a4e1f25ded..6fc115fe3924 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.check_name_availability( @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryCheckNameAvailable.json +# x-ms-original-file: 2025-11-01/RegistryCheckNameAvailable.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py index 406463cc162a..8f5177883b47 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.check_name_availability( @@ -37,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryCheckNameNotAvailable.json +# x-ms-original-file: 2025-11-01/RegistryCheckNameNotAvailable.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py index 3f4a6269b479..7dc6ea43efc1 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.begin_create( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryCreate.json +# x-ms-original-file: 2025-11-01/RegistryCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py index 8b0af1df68bb..8670c9edcee7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.begin_create( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryCreateAbac.json +# x-ms-original-file: 2025-11-01/RegistryCreateAbac.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py index b4e38b4ba6de..6d286a8a36bf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.begin_create( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryCreateZoneRedundant.json +# x-ms-original-file: 2025-11-01/RegistryCreateZoneRedundant.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py index 6bb5b18d760a..325d8f30cdf9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.registries.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryDelete.json +# x-ms-original-file: 2025-11-01/RegistryDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py index c73235464620..b5970886280d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.begin_generate_credentials( @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryGenerateCredentials.json +# x-ms-original-file: 2025-11-01/RegistryGenerateCredentials.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py index 538bedb501da..0a35a50e9afd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryGet.json +# x-ms-original-file: 2025-11-01/RegistryGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py index bf63f61980bf..031583775c46 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.get_private_link_resource( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryGetPrivateLinkResource.json +# x-ms-original-file: 2025-11-01/RegistryGetPrivateLinkResource.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py index b5eb42e44ace..9b5031ca4e2c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryList.json +# x-ms-original-file: 2025-11-01/RegistryList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py index ef5807fbb331..c326f9a5a4d8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryListByResourceGroup.json +# x-ms-original-file: 2025-11-01/RegistryListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py index 6b087e597acc..9ca3a72cce75 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.list_credentials( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryListCredentials.json +# x-ms-original-file: 2025-11-01/RegistryListCredentials.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py index e5cdf588aa85..80acee57c322 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.list_private_link_resources( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryListPrivateLinkResources.json +# x-ms-original-file: 2025-11-01/RegistryListPrivateLinkResources.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py index 048299d244df..ae443948a948 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.list_usages( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryListUsages.json +# x-ms-original-file: 2025-11-01/RegistryListUsages.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py index bbcd5dca8bfc..bab1d6abd810 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.regenerate_credential( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryRegenerateCredential.json +# x-ms-original-file: 2025-11-01/RegistryRegenerateCredential.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py index bf4b61aaddb7..bd962f96d104 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.registries.begin_update( @@ -43,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/RegistryUpdate.json +# x-ms-original-file: 2025-11-01/RegistryUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py index ec0bf26a9a9b..768947104bfd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.replications.begin_create( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationCreate.json +# x-ms-original-file: 2025-11-01/ReplicationCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py index 8465f599e03b..ae6976fc9b37 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.replications.begin_create( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationCreateZoneRedundant.json +# x-ms-original-file: 2025-11-01/ReplicationCreateZoneRedundant.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py index a01f48699b21..3844ae437402 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.replications.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationDelete.json +# x-ms-original-file: 2025-11-01/ReplicationDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py index 790ac3dbe491..a9447ad5d6d9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.replications.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationGet.json +# x-ms-original-file: 2025-11-01/ReplicationGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py index 7e2d7abad49b..daaaf32f0310 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.replications.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationList.json +# x-ms-original-file: 2025-11-01/ReplicationList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py index 538f07355033..be150a9c9935 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.replications.begin_update( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ReplicationUpdate.json +# x-ms-original-file: 2025-11-01/ReplicationUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_cancel.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_cancel.py deleted file mode 100644 index 738b425ba70b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_cancel.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python runs_cancel.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - client.runs.cancel( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_id="0accec26-d6de-4757-8e74-d080f38eaaab", - ) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RunsCancel.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get.py deleted file mode 100644 index ed9379cba948..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python runs_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.runs.get( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_id="0accec26-d6de-4757-8e74-d080f38eaaab", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RunsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get_log_sas_url.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get_log_sas_url.py deleted file mode 100644 index cfdf2669afa1..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_get_log_sas_url.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python runs_get_log_sas_url.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.runs.get_log_sas_url( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_id="0accec26-d6de-4757-8e74-d080f38eaaab", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RunsGetLogSasUrl.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_list.py deleted file mode 100644 index 11b433119e03..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python runs_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.runs.list( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RunsList.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_update.py deleted file mode 100644 index 22a9f6dc6888..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/runs_update.py +++ /dev/null @@ -1,45 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python runs_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.runs.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - run_id="0accec26-d6de-4757-8e74-d080f38eaaab", - run_update_parameters={"isArchiveEnabled": True}, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/RunsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py index 55737fbc1565..8189bce70075 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.scope_maps.begin_create( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ScopeMapCreate.json +# x-ms-original-file: 2025-11-01/ScopeMapCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py index a7d126368ccf..6360ee29c16a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.scope_maps.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ScopeMapDelete.json +# x-ms-original-file: 2025-11-01/ScopeMapDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py index e021b45c14be..5ec9415f3c93 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.scope_maps.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ScopeMapGet.json +# x-ms-original-file: 2025-11-01/ScopeMapGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py index 2877aa71296a..4fe00738f030 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.scope_maps.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ScopeMapList.json +# x-ms-original-file: 2025-11-01/ScopeMapList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py index 90bc0c206702..5a7c6f74804f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.scope_maps.begin_update( @@ -45,6 +44,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/ScopeMapUpdate.json +# x-ms-original-file: 2025-11-01/ScopeMapUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_create.py deleted file mode 100644 index 779f39482ed3..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_create.py +++ /dev/null @@ -1,57 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.task_runs.begin_create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_run_name="myRun", - task_run={ - "properties": { - "forceUpdateTag": "test", - "runRequest": { - "credentials": {}, - "encodedTaskContent": "c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K", - "encodedValuesContent": "Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg==", - "platform": {"architecture": "amd64", "os": "Linux"}, - "type": "EncodedTaskRunRequest", - "values": [], - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_delete.py deleted file mode 100644 index 2374d236c72c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - client.task_runs.delete( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_run_name="myRun", - ) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get.py deleted file mode 100644 index 4a4571f5db80..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.task_runs.get( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_run_name="myRun", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsGet.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get_details.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get_details.py deleted file mode 100644 index afbd4190a37c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_get_details.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_get_details.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.task_runs.get_details( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_run_name="myRun", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsGetDetails.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_list.py deleted file mode 100644 index ee7534a767f5..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.task_runs.list( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsList.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_update.py deleted file mode 100644 index 5ceeb2b24b29..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/task_runs_update.py +++ /dev/null @@ -1,58 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python task_runs_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.task_runs.begin_update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_run_name="myRun", - update_parameters={ - "properties": { - "forceUpdateTag": "test", - "runRequest": { - "credentials": {}, - "encodedTaskContent": "c3RlcHM6IAogIC0gY21kOiB7eyAuVmFsdWVzLmNvbW1hbmQgfX0K", - "encodedValuesContent": "Y29tbWFuZDogYmFzaCBlY2hvIHt7LlJ1bi5SZWdpc3RyeX19Cg==", - "isArchiveEnabled": True, - "platform": {"architecture": "amd64", "os": "Linux"}, - "type": "EncodedTaskRunRequest", - "values": [], - }, - } - }, - ).result() - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TaskRunsUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create.py deleted file mode 100644 index f92f81a8d9db..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create.py +++ /dev/null @@ -1,89 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="mytTask", - task_create_parameters={ - "identity": {"type": "SystemAssigned"}, - "location": "eastus", - "properties": { - "agentConfiguration": {"cpu": 2}, - "isSystemTask": False, - "logTemplate": "acr/tasks:{{.Run.OS}}", - "platform": {"architecture": "amd64", "os": "Linux"}, - "status": "Enabled", - "step": { - "arguments": [ - {"isSecret": False, "name": "mytestargument", "value": "mytestvalue"}, - {"isSecret": True, "name": "mysecrettestargument", "value": "mysecrettestvalue"}, - ], - "contextPath": "src", - "dockerFilePath": "src/DockerFile", - "imageNames": ["azurerest:testtag"], - "isPushEnabled": True, - "noCache": False, - "type": "Docker", - }, - "trigger": { - "baseImageTrigger": { - "baseImageTriggerType": "Runtime", - "name": "myBaseImageTrigger", - "updateTriggerEndpoint": "https://user:pass@mycicd.webhook.com?token=foo", - "updateTriggerPayloadType": "Token", - }, - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": { - "branch": "master", - "repositoryUrl": "https://github.com/Azure/azure-rest-api-specs", - "sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}, - "sourceControlType": "Github", - }, - "sourceTriggerEvents": ["commit"], - } - ], - "timerTriggers": [{"name": "myTimerTrigger", "schedule": "30 9 * * 1-5"}], - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksCreate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create_quick_task.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create_quick_task.py deleted file mode 100644 index f35eba3cbc9f..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_create_quick_task.py +++ /dev/null @@ -1,50 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_create_quick_task.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.create( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="quicktask", - task_create_parameters={ - "identity": None, - "location": "eastus", - "properties": {"isSystemTask": True, "logTemplate": "acr/tasks:{{.Run.OS}}", "status": "Enabled"}, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksCreate_QuickTask.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_delete.py deleted file mode 100644 index ab3ce188d4b6..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_delete.py +++ /dev/null @@ -1,43 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - client.tasks.delete( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - ) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksDelete.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get.py deleted file mode 100644 index 33cee387be6a..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.get( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksGet.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get_details.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get_details.py deleted file mode 100644 index 0c721b6adf25..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_get_details.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_get_details.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.get_details( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksGetDetails.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_list.py deleted file mode 100644 index 3af34bac621d..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_list.py +++ /dev/null @@ -1,44 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_list.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.list( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksList.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update.py deleted file mode 100644 index 3c30079c0810..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update.py +++ /dev/null @@ -1,74 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - task_update_parameters={ - "properties": { - "agentConfiguration": {"cpu": 3}, - "credentials": { - "customRegistries": { - "myregistry.azurecr.io": { - "identity": "[system]", - "password": { - "type": "Vaultsecret", - "value": "https://myacbvault.vault.azure.net/secrets/password", - }, - "userName": {"type": "Opaque", "value": "username"}, - } - } - }, - "logTemplate": "acr/tasks:{{.Run.OS}}", - "status": "Enabled", - "step": {"dockerFilePath": "src/DockerFile", "imageNames": ["azurerest:testtag1"], "type": "Docker"}, - "trigger": { - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": {"sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}}, - "sourceTriggerEvents": ["commit"], - } - ] - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_quick_task.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_quick_task.py deleted file mode 100644 index 103cd408b4a8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_quick_task.py +++ /dev/null @@ -1,48 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update_quick_task.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="quicktask", - task_update_parameters={ - "properties": {"logTemplate": "acr/tasks:{{.Run.OS}}", "status": "Enabled"}, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksUpdate_QuickTask.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_with_opaque_custom_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_with_opaque_custom_credentials.py deleted file mode 100644 index 2512a4caaf02..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/tasks_update_with_opaque_custom_credentials.py +++ /dev/null @@ -1,70 +0,0 @@ -# pylint: disable=line-too-long,useless-suppression -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerregistry -# USAGE - python tasks_update_with_opaque_custom_credentials.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerRegistryManagementClient( - credential=DefaultAzureCredential(), - subscription_id="4385cf00-2d3a-425a-832f-f4285b1c9dce", - ) - - response = client.tasks.update( - resource_group_name="myResourceGroup", - registry_name="myRegistry", - task_name="myTask", - task_update_parameters={ - "properties": { - "agentConfiguration": {"cpu": 3}, - "credentials": { - "customRegistries": { - "myregistry.azurecr.io": { - "password": {"type": "Opaque", "value": "***"}, - "userName": {"type": "Opaque", "value": "username"}, - } - } - }, - "logTemplate": None, - "status": "Enabled", - "step": {"dockerFilePath": "src/DockerFile", "imageNames": ["azurerest:testtag1"], "type": "Docker"}, - "trigger": { - "sourceTriggers": [ - { - "name": "mySourceTrigger", - "sourceRepository": {"sourceControlAuthProperties": {"token": "xxxxx", "tokenType": "PAT"}}, - "sourceTriggerEvents": ["commit"], - } - ] - }, - }, - "tags": {"testkey": "value"}, - }, - ) - print(response) - - -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/RegistryTasks/preview/2025-03-01-preview/examples/TasksUpdate_WithOpaqueCustomCredentials.json -if __name__ == "__main__": - main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py index 4306dc462d49..196a26b3598f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tokens.begin_create( @@ -53,6 +53,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/TokenCreate.json +# x-ms-original-file: 2025-11-01/TokenCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py index 2836d25e74f4..b43781bc0e22 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.tokens.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/TokenDelete.json +# x-ms-original-file: 2025-11-01/TokenDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py index 374ed47d2606..3fef741e1d88 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tokens.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/TokenGet.json +# x-ms-original-file: 2025-11-01/TokenGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py index e1312f2a8b00..c300d4bb8082 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tokens.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/TokenList.json +# x-ms-original-file: 2025-11-01/TokenList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py index f369b963b56f..665f7766a542 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py @@ -3,13 +3,13 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +26,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.tokens.begin_update( @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/TokenUpdate.json +# x-ms-original-file: 2025-11-01/TokenUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py index 48e04d6f9cc0..c5f2a6ba5a7b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.begin_create( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookCreate.json +# x-ms-original-file: 2025-11-01/WebhookCreate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py index 9224adf54967..f6b2b6d5f96d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.webhooks.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookDelete.json +# x-ms-original-file: 2025-11-01/WebhookDelete.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py index b4a273e31fcc..56f4e6946c2b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookGet.json +# x-ms-original-file: 2025-11-01/WebhookGet.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py index 991c65558555..6e867cd030ce 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.get_callback_config( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookGetCallbackConfig.json +# x-ms-original-file: 2025-11-01/WebhookGetCallbackConfig.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py index 147c06da3a62..643ff2c718af 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookList.json +# x-ms-original-file: 2025-11-01/WebhookList.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py index d152082343a2..1fb9f84694cc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.list_events( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookListEvents.json +# x-ms-original-file: 2025-11-01/WebhookListEvents.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py index 612907979276..650c3cffa7e9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.ping( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookPing.json +# x-ms-original-file: 2025-11-01/WebhookPing.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py index 077fdc6608d3..e736e7ed321e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py @@ -1,15 +1,14 @@ -# pylint: disable=line-too-long,useless-suppression # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient """ # PREREQUISITES @@ -26,9 +25,9 @@ def main(): - client = ContainerRegistryManagementClient( + client = ContainerRegistryClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.webhooks.begin_update( @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/stable/2025-11-01/examples/WebhookUpdate.json +# x-ms-original-file: 2025-11-01/WebhookUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py index b1a22879574b..19fdce23b57b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os @@ -21,26 +21,14 @@ # For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - containerregistrymanagement_subscription_id = os.environ.get( - "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" - ) - containerregistrymanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - containerregistrymanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - containerregistrymanagement_client_secret = os.environ.get( - "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer( - regex=containerregistrymanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer( - regex=containerregistrymanagement_tenant_id, value="00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer( - regex=containerregistrymanagement_client_id, value="00000000-0000-0000-0000-000000000000" - ) - add_general_regex_sanitizer( - regex=containerregistrymanagement_client_secret, value="00000000-0000-0000-0000-000000000000" - ) + containerregistry_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") + containerregistry_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + containerregistry_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + containerregistry_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerregistry_subscription_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerregistry_tenant_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerregistry_client_id, value="00000000-0000-0000-0000-000000000000") + add_general_regex_sanitizer(regex=containerregistry_client_secret, value="00000000-0000-0000-0000-000000000000") add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py similarity index 80% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py index 9a1dee8cea5e..bbdd7c7401f6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementCacheRulesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryCacheRulesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_cache_rules_list(self, resource_group): - response = self.client.cache_rules.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_cache_rules_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -51,12 +38,15 @@ def test_cache_rules_begin_create(self, resource_group): registry_name="str", cache_rule_name="str", cache_rule_create_parameters={ - "creationDate": "2020-02-20 00:00:00", - "credentialSetResourceId": "str", "id": "str", "name": "str", - "provisioningState": "str", - "sourceRepository": "str", + "properties": { + "creationDate": "2020-02-20 00:00:00", + "credentialSetResourceId": "str", + "provisioningState": "str", + "sourceRepository": "str", + "targetRepository": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -65,10 +55,8 @@ def test_cache_rules_begin_create(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "targetRepository": "str", "type": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,8 +69,7 @@ def test_cache_rules_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - cache_rule_update_parameters={"credentialSetResourceId": "str"}, - api_version="2025-11-01", + cache_rule_update_parameters={"properties": {"credentialSetResourceId": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -95,8 +82,18 @@ def test_cache_rules_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_cache_rules_list(self, resource_group): + response = self.client.cache_rules.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py index 7575d0bce0c0..f467a020d4a0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementCacheRulesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryCacheRulesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_cache_rules_list(self, resource_group): - response = self.client.cache_rules.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_cache_rules_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,12 +40,15 @@ async def test_cache_rules_begin_create(self, resource_group): registry_name="str", cache_rule_name="str", cache_rule_create_parameters={ - "creationDate": "2020-02-20 00:00:00", - "credentialSetResourceId": "str", "id": "str", "name": "str", - "provisioningState": "str", - "sourceRepository": "str", + "properties": { + "creationDate": "2020-02-20 00:00:00", + "credentialSetResourceId": "str", + "provisioningState": "str", + "sourceRepository": "str", + "targetRepository": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -67,10 +57,8 @@ async def test_cache_rules_begin_create(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "targetRepository": "str", "type": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -85,8 +73,7 @@ async def test_cache_rules_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - cache_rule_update_parameters={"credentialSetResourceId": "str"}, - api_version="2025-11-01", + cache_rule_update_parameters={"properties": {"credentialSetResourceId": "str"}}, ) ).result() # call '.result()' to poll until service return final result @@ -101,9 +88,19 @@ async def test_cache_rules_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", cache_rule_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_cache_rules_list(self, resource_group): + response = self.client.cache_rules.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py similarity index 66% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py index dc816380f8fa..0c7872402a10 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementConnectedRegistriesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryConnectedRegistriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_connected_registries_list(self, resource_group): - response = self.client.connected_registries.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_connected_registries_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -51,41 +38,44 @@ def test_connected_registries_begin_create(self, resource_group): registry_name="str", connected_registry_name="str", connected_registry_create_parameters={ - "activation": {"status": "str"}, - "clientTokenIds": ["str"], - "connectionState": "str", - "garbageCollection": {"enabled": bool, "schedule": "str"}, "id": "str", - "lastActivityTime": "2020-02-20 00:00:00", - "logging": {"auditLogStatus": "Disabled", "logLevel": "Information"}, - "loginServer": { - "host": "str", - "tls": {"certificate": {"location": "str", "type": "str"}, "status": "str"}, - }, - "mode": "str", "name": "str", - "notificationsList": ["str"], - "parent": { - "syncProperties": { - "messageTtl": "1 day, 0:00:00", - "tokenId": "str", - "gatewayEndpoint": "str", - "lastSyncTime": "2020-02-20 00:00:00", - "schedule": "str", - "syncWindow": "1 day, 0:00:00", + "properties": { + "mode": "str", + "parent": { + "syncProperties": { + "messageTtl": "1 day, 0:00:00", + "tokenId": "str", + "gatewayEndpoint": "str", + "lastSyncTime": "2020-02-20 00:00:00", + "schedule": "str", + "syncWindow": "1 day, 0:00:00", + }, + "id": "str", + }, + "activation": {"status": "str"}, + "clientTokenIds": ["str"], + "connectionState": "str", + "garbageCollection": {"enabled": bool, "schedule": "str"}, + "lastActivityTime": "2020-02-20 00:00:00", + "logging": {"auditLogStatus": "str", "logLevel": "str"}, + "loginServer": { + "host": "str", + "tls": {"certificate": {"location": "str", "type": "str"}, "status": "str"}, }, - "id": "str", + "notificationsList": ["str"], + "provisioningState": "str", + "statusDetails": [ + { + "code": "str", + "correlationId": "str", + "description": "str", + "timestamp": "2020-02-20 00:00:00", + "type": "str", + } + ], + "version": "str", }, - "provisioningState": "str", - "statusDetails": [ - { - "code": "str", - "correlationId": "str", - "description": "str", - "timestamp": "2020-02-20 00:00:00", - "type": "str", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -95,9 +85,7 @@ def test_connected_registries_begin_create(self, resource_group): "lastModifiedByType": "str", }, "type": "str", - "version": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -111,13 +99,18 @@ def test_connected_registries_begin_update(self, resource_group): registry_name="str", connected_registry_name="str", connected_registry_update_parameters={ - "clientTokenIds": ["str"], - "garbageCollection": {"enabled": bool, "schedule": "str"}, - "logging": {"auditLogStatus": "Disabled", "logLevel": "Information"}, - "notificationsList": ["str"], - "syncProperties": {"messageTtl": "1 day, 0:00:00", "schedule": "str", "syncWindow": "1 day, 0:00:00"}, + "properties": { + "clientTokenIds": ["str"], + "garbageCollection": {"enabled": bool, "schedule": "str"}, + "logging": {"auditLogStatus": "str", "logLevel": "str"}, + "notificationsList": ["str"], + "syncProperties": { + "messageTtl": "1 day, 0:00:00", + "schedule": "str", + "syncWindow": "1 day, 0:00:00", + }, + } }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -130,12 +123,22 @@ def test_connected_registries_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_connected_registries_list(self, resource_group): + response = self.client.connected_registries.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_connected_registries_begin_deactivate(self, resource_group): @@ -143,7 +146,6 @@ def test_connected_registries_begin_deactivate(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py similarity index 66% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py index 73a3696936cd..442e3a7d0eae 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementConnectedRegistriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryConnectedRegistriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_connected_registries_list(self, resource_group): - response = self.client.connected_registries.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_connected_registries_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,41 +40,44 @@ async def test_connected_registries_begin_create(self, resource_group): registry_name="str", connected_registry_name="str", connected_registry_create_parameters={ - "activation": {"status": "str"}, - "clientTokenIds": ["str"], - "connectionState": "str", - "garbageCollection": {"enabled": bool, "schedule": "str"}, "id": "str", - "lastActivityTime": "2020-02-20 00:00:00", - "logging": {"auditLogStatus": "Disabled", "logLevel": "Information"}, - "loginServer": { - "host": "str", - "tls": {"certificate": {"location": "str", "type": "str"}, "status": "str"}, - }, - "mode": "str", "name": "str", - "notificationsList": ["str"], - "parent": { - "syncProperties": { - "messageTtl": "1 day, 0:00:00", - "tokenId": "str", - "gatewayEndpoint": "str", - "lastSyncTime": "2020-02-20 00:00:00", - "schedule": "str", - "syncWindow": "1 day, 0:00:00", + "properties": { + "mode": "str", + "parent": { + "syncProperties": { + "messageTtl": "1 day, 0:00:00", + "tokenId": "str", + "gatewayEndpoint": "str", + "lastSyncTime": "2020-02-20 00:00:00", + "schedule": "str", + "syncWindow": "1 day, 0:00:00", + }, + "id": "str", + }, + "activation": {"status": "str"}, + "clientTokenIds": ["str"], + "connectionState": "str", + "garbageCollection": {"enabled": bool, "schedule": "str"}, + "lastActivityTime": "2020-02-20 00:00:00", + "logging": {"auditLogStatus": "str", "logLevel": "str"}, + "loginServer": { + "host": "str", + "tls": {"certificate": {"location": "str", "type": "str"}, "status": "str"}, }, - "id": "str", + "notificationsList": ["str"], + "provisioningState": "str", + "statusDetails": [ + { + "code": "str", + "correlationId": "str", + "description": "str", + "timestamp": "2020-02-20 00:00:00", + "type": "str", + } + ], + "version": "str", }, - "provisioningState": "str", - "statusDetails": [ - { - "code": "str", - "correlationId": "str", - "description": "str", - "timestamp": "2020-02-20 00:00:00", - "type": "str", - } - ], "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -97,9 +87,7 @@ async def test_connected_registries_begin_create(self, resource_group): "lastModifiedByType": "str", }, "type": "str", - "version": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -115,17 +103,18 @@ async def test_connected_registries_begin_update(self, resource_group): registry_name="str", connected_registry_name="str", connected_registry_update_parameters={ - "clientTokenIds": ["str"], - "garbageCollection": {"enabled": bool, "schedule": "str"}, - "logging": {"auditLogStatus": "Disabled", "logLevel": "Information"}, - "notificationsList": ["str"], - "syncProperties": { - "messageTtl": "1 day, 0:00:00", - "schedule": "str", - "syncWindow": "1 day, 0:00:00", - }, + "properties": { + "clientTokenIds": ["str"], + "garbageCollection": {"enabled": bool, "schedule": "str"}, + "logging": {"auditLogStatus": "str", "logLevel": "str"}, + "notificationsList": ["str"], + "syncProperties": { + "messageTtl": "1 day, 0:00:00", + "schedule": "str", + "syncWindow": "1 day, 0:00:00", + }, + } }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -140,13 +129,23 @@ async def test_connected_registries_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_connected_registries_list(self, resource_group): + response = self.client.connected_registries.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_connected_registries_begin_deactivate(self, resource_group): @@ -155,7 +154,6 @@ async def test_connected_registries_begin_deactivate(self, resource_group): resource_group_name=resource_group.name, registry_name="str", connected_registry_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py similarity index 74% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py index 18e9b5af2a3b..07fd68155be4 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementCredentialSetsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryCredentialSetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_credential_sets_list(self, resource_group): - response = self.client.credential_sets.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_credential_sets_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", credential_set_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -51,15 +38,6 @@ def test_credential_sets_begin_create(self, resource_group): registry_name="str", credential_set_name="str", credential_set_create_parameters={ - "authCredentials": [ - { - "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, - "name": "str", - "passwordSecretIdentifier": "str", - "usernameSecretIdentifier": "str", - } - ], - "creationDate": "2020-02-20 00:00:00", "id": "str", "identity": { "principalId": "str", @@ -67,9 +45,20 @@ def test_credential_sets_begin_create(self, resource_group): "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "loginServer": "str", "name": "str", - "provisioningState": "str", + "properties": { + "authCredentials": [ + { + "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, + "name": "str", + "passwordSecretIdentifier": "str", + "usernameSecretIdentifier": "str", + } + ], + "creationDate": "2020-02-20 00:00:00", + "loginServer": "str", + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -80,7 +69,6 @@ def test_credential_sets_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,22 +82,23 @@ def test_credential_sets_begin_update(self, resource_group): registry_name="str", credential_set_name="str", credential_set_update_parameters={ - "authCredentials": [ - { - "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, - "name": "str", - "passwordSecretIdentifier": "str", - "usernameSecretIdentifier": "str", - } - ], "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "properties": { + "authCredentials": [ + { + "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, + "name": "str", + "passwordSecretIdentifier": "str", + "usernameSecretIdentifier": "str", + } + ] + }, }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -122,8 +111,18 @@ def test_credential_sets_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", credential_set_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_credential_sets_list(self, resource_group): + response = self.client.credential_sets.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py similarity index 75% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py index e8a96fa73760..d57593fdde82 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementCredentialSetsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryCredentialSetsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_credential_sets_list(self, resource_group): - response = self.client.credential_sets.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_credential_sets_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", credential_set_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,15 +40,6 @@ async def test_credential_sets_begin_create(self, resource_group): registry_name="str", credential_set_name="str", credential_set_create_parameters={ - "authCredentials": [ - { - "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, - "name": "str", - "passwordSecretIdentifier": "str", - "usernameSecretIdentifier": "str", - } - ], - "creationDate": "2020-02-20 00:00:00", "id": "str", "identity": { "principalId": "str", @@ -69,9 +47,20 @@ async def test_credential_sets_begin_create(self, resource_group): "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "loginServer": "str", "name": "str", - "provisioningState": "str", + "properties": { + "authCredentials": [ + { + "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, + "name": "str", + "passwordSecretIdentifier": "str", + "usernameSecretIdentifier": "str", + } + ], + "creationDate": "2020-02-20 00:00:00", + "loginServer": "str", + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -82,7 +71,6 @@ async def test_credential_sets_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -98,22 +86,23 @@ async def test_credential_sets_begin_update(self, resource_group): registry_name="str", credential_set_name="str", credential_set_update_parameters={ - "authCredentials": [ - { - "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, - "name": "str", - "passwordSecretIdentifier": "str", - "usernameSecretIdentifier": "str", - } - ], "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, + "properties": { + "authCredentials": [ + { + "credentialHealth": {"errorCode": "str", "errorMessage": "str", "status": "str"}, + "name": "str", + "passwordSecretIdentifier": "str", + "usernameSecretIdentifier": "str", + } + ] + }, }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -128,9 +117,19 @@ async def test_credential_sets_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", credential_set_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_credential_sets_list(self, resource_group): + response = self.client.credential_sets.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations.py deleted file mode 100644 index eb317f844787..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations.py +++ /dev/null @@ -1,117 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementAgentPoolsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_list(self, resource_group): - response = self.client.agent_pools.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_get(self, resource_group): - response = self.client.agent_pools.get( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_begin_create(self, resource_group): - response = self.client.agent_pools.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - agent_pool={ - "location": "str", - "count": 0, - "id": "str", - "name": "str", - "os": "str", - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "tier": "str", - "type": "str", - "virtualNetworkSubnetResourceId": "str", - }, - api_version="2025-03-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_begin_update(self, resource_group): - response = self.client.agent_pools.begin_update( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - update_parameters={"count": 0, "tags": {"str": "str"}}, - api_version="2025-03-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_begin_delete(self, resource_group): - response = self.client.agent_pools.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_agent_pools_get_queue_status(self, resource_group): - response = self.client.agent_pools.get_queue_status( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations_async.py deleted file mode 100644 index d9993e3dc747..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_agent_pools_operations_async.py +++ /dev/null @@ -1,124 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementAgentPoolsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_list(self, resource_group): - response = self.client.agent_pools.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_get(self, resource_group): - response = await self.client.agent_pools.get( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_begin_create(self, resource_group): - response = await ( - await self.client.agent_pools.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - agent_pool={ - "location": "str", - "count": 0, - "id": "str", - "name": "str", - "os": "str", - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "tier": "str", - "type": "str", - "virtualNetworkSubnetResourceId": "str", - }, - api_version="2025-03-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_begin_update(self, resource_group): - response = await ( - await self.client.agent_pools.begin_update( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - update_parameters={"count": 0, "tags": {"str": "str"}}, - api_version="2025-03-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_begin_delete(self, resource_group): - response = await ( - await self.client.agent_pools.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_agent_pools_get_queue_status(self, resource_group): - response = await self.client.agent_pools.get_queue_status( - resource_group_name=resource_group.name, - registry_name="str", - agent_pool_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations.py deleted file mode 100644 index be4b58d72c28..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations.py +++ /dev/null @@ -1,78 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementArchiveVersionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archive_versions_list(self, resource_group): - response = self.client.archive_versions.list( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archive_versions_get(self, resource_group): - response = self.client.archive_versions.get( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archive_versions_begin_create(self, resource_group): - response = self.client.archive_versions.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archive_versions_begin_delete(self, resource_group): - response = self.client.archive_versions.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations_async.py deleted file mode 100644 index 16615b6f3ee8..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archive_versions_operations_async.py +++ /dev/null @@ -1,83 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementArchiveVersionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archive_versions_list(self, resource_group): - response = self.client.archive_versions.list( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archive_versions_get(self, resource_group): - response = await self.client.archive_versions.get( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archive_versions_begin_create(self, resource_group): - response = await ( - await self.client.archive_versions.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archive_versions_begin_delete(self, resource_group): - response = await ( - await self.client.archive_versions.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_version_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations.py deleted file mode 100644 index 35f14141539f..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations.py +++ /dev/null @@ -1,107 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementArchivesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archives_list(self, resource_group): - response = self.client.archives.list( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - api_version="2025-05-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archives_get(self, resource_group): - response = self.client.archives.get( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archives_begin_create(self, resource_group): - response = self.client.archives.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_create_parameters={ - "id": "str", - "name": "str", - "packageSource": {"type": "str", "url": "str"}, - "provisioningState": "str", - "publishedVersion": "str", - "repositoryEndpoint": "str", - "repositoryEndpointPrefix": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archives_begin_delete(self, resource_group): - response = self.client.archives.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_archives_update(self, resource_group): - response = self.client.archives.update( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_update_parameters={"publishedVersion": "str"}, - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations_async.py deleted file mode 100644 index 5b85021fb40e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_archives_operations_async.py +++ /dev/null @@ -1,112 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementArchivesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archives_list(self, resource_group): - response = self.client.archives.list( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - api_version="2025-05-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archives_get(self, resource_group): - response = await self.client.archives.get( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archives_begin_create(self, resource_group): - response = await ( - await self.client.archives.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_create_parameters={ - "id": "str", - "name": "str", - "packageSource": {"type": "str", "url": "str"}, - "provisioningState": "str", - "publishedVersion": "str", - "repositoryEndpoint": "str", - "repositoryEndpointPrefix": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archives_begin_delete(self, resource_group): - response = await ( - await self.client.archives.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_archives_update(self, resource_group): - response = await self.client.archives.update( - resource_group_name=resource_group.name, - registry_name="str", - package_type="str", - archive_name="str", - archive_update_parameters={"publishedVersion": "str"}, - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations.py deleted file mode 100644 index 56928e88afae..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations.py +++ /dev/null @@ -1,93 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementExportPipelinesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_export_pipelines_list(self, resource_group): - response = self.client.export_pipelines.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_export_pipelines_get(self, resource_group): - response = self.client.export_pipelines.get( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_export_pipelines_begin_create(self, resource_group): - response = self.client.export_pipelines.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - export_pipeline_create_parameters={ - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "options": ["str"], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "target": {"keyVaultUri": "str", "type": "str", "uri": "str"}, - "type": "str", - }, - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_export_pipelines_begin_delete(self, resource_group): - response = self.client.export_pipelines.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations_async.py deleted file mode 100644 index 25d5a769dcb7..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_export_pipelines_operations_async.py +++ /dev/null @@ -1,98 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementExportPipelinesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_export_pipelines_list(self, resource_group): - response = self.client.export_pipelines.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_export_pipelines_get(self, resource_group): - response = await self.client.export_pipelines.get( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_export_pipelines_begin_create(self, resource_group): - response = await ( - await self.client.export_pipelines.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - export_pipeline_create_parameters={ - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "options": ["str"], - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "target": {"keyVaultUri": "str", "type": "str", "uri": "str"}, - "type": "str", - }, - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_export_pipelines_begin_delete(self, resource_group): - response = await ( - await self.client.export_pipelines.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - export_pipeline_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations.py deleted file mode 100644 index 547a76390199..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations.py +++ /dev/null @@ -1,94 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementImportPipelinesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_import_pipelines_list(self, resource_group): - response = self.client.import_pipelines.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_import_pipelines_get(self, resource_group): - response = self.client.import_pipelines.get( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_import_pipelines_begin_create(self, resource_group): - response = self.client.import_pipelines.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - import_pipeline_create_parameters={ - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "options": ["str"], - "provisioningState": "str", - "source": {"keyVaultUri": "str", "type": "AzureStorageBlobContainer", "uri": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "trigger": {"sourceTrigger": {"status": "str"}}, - "type": "str", - }, - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_import_pipelines_begin_delete(self, resource_group): - response = self.client.import_pipelines.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations_async.py deleted file mode 100644 index 04b52bf9d75b..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_import_pipelines_operations_async.py +++ /dev/null @@ -1,99 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementImportPipelinesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_import_pipelines_list(self, resource_group): - response = self.client.import_pipelines.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_import_pipelines_get(self, resource_group): - response = await self.client.import_pipelines.get( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_import_pipelines_begin_create(self, resource_group): - response = await ( - await self.client.import_pipelines.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - import_pipeline_create_parameters={ - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "options": ["str"], - "provisioningState": "str", - "source": {"keyVaultUri": "str", "type": "AzureStorageBlobContainer", "uri": "str"}, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "trigger": {"sourceTrigger": {"status": "str"}}, - "type": "str", - }, - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_import_pipelines_begin_delete(self, resource_group): - response = await ( - await self.client.import_pipelines.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - import_pipeline_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations.py deleted file mode 100644 index 29a6ade41366..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations.py +++ /dev/null @@ -1,104 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementPipelineRunsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_pipeline_runs_list(self, resource_group): - response = self.client.pipeline_runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_pipeline_runs_get(self, resource_group): - response = self.client.pipeline_runs.get( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_pipeline_runs_begin_create(self, resource_group): - response = self.client.pipeline_runs.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - pipeline_run_create_parameters={ - "forceUpdateTag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "request": { - "artifacts": ["str"], - "catalogDigest": "str", - "pipelineResourceId": "str", - "source": {"name": "str", "type": "AzureStorageBlob"}, - "target": {"name": "str", "type": "AzureStorageBlob"}, - }, - "response": { - "catalogDigest": "str", - "finishTime": "2020-02-20 00:00:00", - "importedArtifacts": ["str"], - "pipelineRunErrorMessage": "str", - "progress": {"percentage": "str"}, - "source": {"keyVaultUri": "str", "type": "AzureStorageBlobContainer", "uri": "str"}, - "startTime": "2020-02-20 00:00:00", - "status": "str", - "target": {"keyVaultUri": "str", "type": "str", "uri": "str"}, - "trigger": {"sourceTrigger": {"timestamp": "2020-02-20 00:00:00"}}, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_pipeline_runs_begin_delete(self, resource_group): - response = self.client.pipeline_runs.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - api_version="2025-05-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations_async.py deleted file mode 100644 index 51957542102c..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_pipeline_runs_operations_async.py +++ /dev/null @@ -1,109 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementPipelineRunsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_pipeline_runs_list(self, resource_group): - response = self.client.pipeline_runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-05-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_pipeline_runs_get(self, resource_group): - response = await self.client.pipeline_runs.get( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - api_version="2025-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_pipeline_runs_begin_create(self, resource_group): - response = await ( - await self.client.pipeline_runs.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - pipeline_run_create_parameters={ - "forceUpdateTag": "str", - "id": "str", - "name": "str", - "provisioningState": "str", - "request": { - "artifacts": ["str"], - "catalogDigest": "str", - "pipelineResourceId": "str", - "source": {"name": "str", "type": "AzureStorageBlob"}, - "target": {"name": "str", "type": "AzureStorageBlob"}, - }, - "response": { - "catalogDigest": "str", - "finishTime": "2020-02-20 00:00:00", - "importedArtifacts": ["str"], - "pipelineRunErrorMessage": "str", - "progress": {"percentage": "str"}, - "source": {"keyVaultUri": "str", "type": "AzureStorageBlobContainer", "uri": "str"}, - "startTime": "2020-02-20 00:00:00", - "status": "str", - "target": {"keyVaultUri": "str", "type": "str", "uri": "str"}, - "trigger": {"sourceTrigger": {"timestamp": "2020-02-20 00:00:00"}}, - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_pipeline_runs_begin_delete(self, resource_group): - response = await ( - await self.client.pipeline_runs.begin_delete( - resource_group_name=resource_group.name, - registry_name="str", - pipeline_run_name="str", - api_version="2025-05-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations.py deleted file mode 100644 index 21584110cedf..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations.py +++ /dev/null @@ -1,84 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementRunsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_runs_list(self, resource_group): - response = self.client.runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_runs_get(self, resource_group): - response = self.client.runs.get( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_runs_update(self, resource_group): - response = self.client.runs.update( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - run_update_parameters={"isArchiveEnabled": bool}, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_runs_cancel(self, resource_group): - response = self.client.runs.cancel( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_runs_get_log_sas_url(self, resource_group): - response = self.client.runs.get_log_sas_url( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations_async.py deleted file mode 100644 index 801a15a28be5..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_runs_operations_async.py +++ /dev/null @@ -1,85 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementRunsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_runs_list(self, resource_group): - response = self.client.runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_runs_get(self, resource_group): - response = await self.client.runs.get( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_runs_update(self, resource_group): - response = await self.client.runs.update( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - run_update_parameters={"isArchiveEnabled": bool}, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_runs_cancel(self, resource_group): - response = await self.client.runs.cancel( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_runs_get_log_sas_url(self, resource_group): - response = await self.client.runs.get_log_sas_url( - resource_group_name=resource_group.name, - registry_name="str", - run_id="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations.py deleted file mode 100644 index dca39c9f11e4..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations.py +++ /dev/null @@ -1,178 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTaskRunsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_list(self, resource_group): - response = self.client.task_runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_get(self, resource_group): - response = self.client.task_runs.get( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_begin_create(self, resource_group): - response = self.client.task_runs.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - task_run={ - "forceUpdateTag": "str", - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "provisioningState": "str", - "runRequest": "run_request", - "runResult": { - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "createTime": "2020-02-20 00:00:00", - "customRegistries": ["str"], - "finishTime": "2020-02-20 00:00:00", - "id": "str", - "imageUpdateTrigger": { - "id": "str", - "images": [{"digest": "str", "registry": "str", "repository": "str", "tag": "str"}], - "timestamp": "2020-02-20 00:00:00", - }, - "isArchiveEnabled": False, - "lastUpdatedTime": "2020-02-20 00:00:00", - "logArtifact": {"digest": "str", "registry": "str", "repository": "str", "tag": "str"}, - "name": "str", - "outputImages": [{"digest": "str", "registry": "str", "repository": "str", "tag": "str"}], - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "provisioningState": "str", - "runErrorMessage": "str", - "runId": "str", - "runType": "str", - "sourceRegistryAuth": "str", - "sourceTrigger": { - "branchName": "str", - "commitId": "str", - "eventType": "str", - "id": "str", - "providerType": "str", - "pullRequestId": "str", - "repositoryUrl": "str", - }, - "startTime": "2020-02-20 00:00:00", - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "task": "str", - "timerTrigger": {"scheduleOccurrence": "str", "timerTriggerName": "str"}, - "type": "str", - "updateTriggerToken": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-03-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_begin_update(self, resource_group): - response = self.client.task_runs.begin_update( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - update_parameters={ - "forceUpdateTag": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "runRequest": "run_request", - "tags": {"str": "str"}, - }, - api_version="2025-03-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_delete(self, resource_group): - response = self.client.task_runs.delete( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_task_runs_get_details(self, resource_group): - response = self.client.task_runs.get_details( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations_async.py deleted file mode 100644 index 8e2e260e756e..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_task_runs_operations_async.py +++ /dev/null @@ -1,183 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTaskRunsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_list(self, resource_group): - response = self.client.task_runs.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_get(self, resource_group): - response = await self.client.task_runs.get( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_begin_create(self, resource_group): - response = await ( - await self.client.task_runs.begin_create( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - task_run={ - "forceUpdateTag": "str", - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "name": "str", - "provisioningState": "str", - "runRequest": "run_request", - "runResult": { - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "createTime": "2020-02-20 00:00:00", - "customRegistries": ["str"], - "finishTime": "2020-02-20 00:00:00", - "id": "str", - "imageUpdateTrigger": { - "id": "str", - "images": [{"digest": "str", "registry": "str", "repository": "str", "tag": "str"}], - "timestamp": "2020-02-20 00:00:00", - }, - "isArchiveEnabled": False, - "lastUpdatedTime": "2020-02-20 00:00:00", - "logArtifact": {"digest": "str", "registry": "str", "repository": "str", "tag": "str"}, - "name": "str", - "outputImages": [{"digest": "str", "registry": "str", "repository": "str", "tag": "str"}], - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "provisioningState": "str", - "runErrorMessage": "str", - "runId": "str", - "runType": "str", - "sourceRegistryAuth": "str", - "sourceTrigger": { - "branchName": "str", - "commitId": "str", - "eventType": "str", - "id": "str", - "providerType": "str", - "pullRequestId": "str", - "repositoryUrl": "str", - }, - "startTime": "2020-02-20 00:00:00", - "status": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "task": "str", - "timerTrigger": {"scheduleOccurrence": "str", "timerTriggerName": "str"}, - "type": "str", - "updateTriggerToken": "str", - }, - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - }, - api_version="2025-03-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_begin_update(self, resource_group): - response = await ( - await self.client.task_runs.begin_update( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - update_parameters={ - "forceUpdateTag": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "location": "str", - "runRequest": "run_request", - "tags": {"str": "str"}, - }, - api_version="2025-03-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_delete(self, resource_group): - response = await self.client.task_runs.delete( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_task_runs_get_details(self, resource_group): - response = await self.client.task_runs.get_details( - resource_group_name=resource_group.name, - registry_name="str", - task_run_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations.py deleted file mode 100644 index 535f267a7967..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations.py +++ /dev/null @@ -1,221 +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 pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTasksOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_list(self, resource_group): - response = self.client.tasks.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_get(self, resource_group): - response = self.client.tasks.get( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_create(self, resource_group): - response = self.client.tasks.create( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - task_create_parameters={ - "location": "str", - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "creationDate": "2020-02-20 00:00:00", - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "isSystemTask": False, - "logTemplate": "str", - "name": "str", - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "provisioningState": "str", - "status": "str", - "step": "task_step_properties", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeout": 3600, - "trigger": { - "baseImageTrigger": { - "baseImageTriggerType": "str", - "name": "str", - "status": "str", - "updateTriggerEndpoint": "str", - "updateTriggerPayloadType": "str", - }, - "sourceTriggers": [ - { - "name": "str", - "sourceRepository": { - "repositoryUrl": "str", - "sourceControlType": "str", - "branch": "str", - "sourceControlAuthProperties": { - "token": "str", - "tokenType": "str", - "expiresIn": 0, - "refreshToken": "str", - "scope": "str", - }, - }, - "sourceTriggerEvents": ["str"], - "status": "str", - } - ], - "timerTriggers": [{"name": "str", "schedule": "str", "status": "str"}], - }, - "type": "str", - }, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_update(self, resource_group): - response = self.client.tasks.update( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - task_update_parameters={ - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "logTemplate": "str", - "platform": {"architecture": "str", "os": "str", "variant": "str"}, - "status": "str", - "step": "task_step_update_parameters", - "tags": {"str": "str"}, - "timeout": 0, - "trigger": { - "baseImageTrigger": { - "name": "str", - "baseImageTriggerType": "str", - "status": "str", - "updateTriggerEndpoint": "str", - "updateTriggerPayloadType": "str", - }, - "sourceTriggers": [ - { - "name": "str", - "sourceRepository": { - "branch": "str", - "repositoryUrl": "str", - "sourceControlAuthProperties": { - "expiresIn": 0, - "refreshToken": "str", - "scope": "str", - "token": "str", - "tokenType": "str", - }, - "sourceControlType": "str", - }, - "sourceTriggerEvents": ["str"], - "status": "str", - } - ], - "timerTriggers": [{"name": "str", "schedule": "str", "status": "str"}], - }, - }, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_delete(self, resource_group): - response = self.client.tasks.delete( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tasks_get_details(self, resource_group): - response = self.client.tasks.get_details( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations_async.py deleted file mode 100644 index cbc171e982ce..000000000000 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tasks_operations_async.py +++ /dev/null @@ -1,222 +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 pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTasksOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_list(self, resource_group): - response = self.client.tasks.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-03-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_get(self, resource_group): - response = await self.client.tasks.get( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_create(self, resource_group): - response = await self.client.tasks.create( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - task_create_parameters={ - "location": "str", - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "creationDate": "2020-02-20 00:00:00", - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "id": "str", - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "isSystemTask": False, - "logTemplate": "str", - "name": "str", - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "provisioningState": "str", - "status": "str", - "step": "task_step_properties", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "tags": {"str": "str"}, - "timeout": 3600, - "trigger": { - "baseImageTrigger": { - "baseImageTriggerType": "str", - "name": "str", - "status": "str", - "updateTriggerEndpoint": "str", - "updateTriggerPayloadType": "str", - }, - "sourceTriggers": [ - { - "name": "str", - "sourceRepository": { - "repositoryUrl": "str", - "sourceControlType": "str", - "branch": "str", - "sourceControlAuthProperties": { - "token": "str", - "tokenType": "str", - "expiresIn": 0, - "refreshToken": "str", - "scope": "str", - }, - }, - "sourceTriggerEvents": ["str"], - "status": "str", - } - ], - "timerTriggers": [{"name": "str", "schedule": "str", "status": "str"}], - }, - "type": "str", - }, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_update(self, resource_group): - response = await self.client.tasks.update( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - task_update_parameters={ - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "identity": { - "principalId": "str", - "tenantId": "str", - "type": "str", - "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, - }, - "logTemplate": "str", - "platform": {"architecture": "str", "os": "str", "variant": "str"}, - "status": "str", - "step": "task_step_update_parameters", - "tags": {"str": "str"}, - "timeout": 0, - "trigger": { - "baseImageTrigger": { - "name": "str", - "baseImageTriggerType": "str", - "status": "str", - "updateTriggerEndpoint": "str", - "updateTriggerPayloadType": "str", - }, - "sourceTriggers": [ - { - "name": "str", - "sourceRepository": { - "branch": "str", - "repositoryUrl": "str", - "sourceControlAuthProperties": { - "expiresIn": 0, - "refreshToken": "str", - "scope": "str", - "token": "str", - "tokenType": "str", - }, - "sourceControlType": "str", - }, - "sourceTriggerEvents": ["str"], - "status": "str", - } - ], - "timerTriggers": [{"name": "str", "schedule": "str", "status": "str"}], - }, - }, - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_delete(self, resource_group): - response = await self.client.tasks.delete( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tasks_get_details(self, resource_group): - response = await self.client.tasks.get_details( - resource_group_name=resource_group.name, - registry_name="str", - task_name="str", - api_version="2025-03-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py similarity index 70% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py index 2352a73313d3..911b9efd5023 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,16 +14,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-11-01", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py similarity index 70% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py index 0c7b8bb8e522..bc3fd2772634 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,16 +15,14 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-11-01", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py similarity index 82% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py index 758586ae3bc2..7f3261f2f9a0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_list(self, resource_group): - response = self.client.private_endpoint_connections.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", private_endpoint_connection_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,9 +40,15 @@ def test_private_endpoint_connections_begin_create_or_update(self, resource_grou private_endpoint_connection={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"actionsRequired": "str", "description": "str", "status": "str"}, - "provisioningState": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -66,7 +59,6 @@ def test_private_endpoint_connections_begin_create_or_update(self, resource_grou }, "type": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -79,8 +71,18 @@ def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", private_endpoint_connection_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py similarity index 80% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py index 2bb207d9a267..2701c3f25da6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_list(self, resource_group): - response = self.client.private_endpoint_connections.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", private_endpoint_connection_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -55,13 +42,15 @@ async def test_private_endpoint_connections_begin_create_or_update(self, resourc private_endpoint_connection={ "id": "str", "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", }, - "provisioningState": "str", "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -72,7 +61,6 @@ async def test_private_endpoint_connections_begin_create_or_update(self, resourc }, "type": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -87,9 +75,19 @@ async def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", private_endpoint_connection_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_private_endpoint_connections_list(self, resource_group): + response = self.client.private_endpoint_connections.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py similarity index 54% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py index bce3e66c4d6d..42eca8199a9f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,46 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementRegistriesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryRegistriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_registries_check_name_availability(self, resource_group): - response = self.client.registries.check_name_availability( - registry_name_check_request={ - "name": "str", - "type": "Microsoft.ContainerRegistry/registries", - "autoGeneratedDomainNameLabelScope": "str", - "resourceGroupName": "str", - }, - api_version="2025-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_registries_list(self, resource_group): - response = self.client.registries.list( - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_registries_list_by_resource_group(self, resource_group): - response = self.client.registries.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -61,7 +24,6 @@ def test_registries_get(self, resource_group): response = self.client.registries.get( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -76,22 +38,6 @@ def test_registries_begin_create(self, resource_group): registry={ "location": "str", "sku": {"name": "str", "tier": "str"}, - "adminUserEnabled": False, - "anonymousPullEnabled": False, - "autoGeneratedDomainNameLabelScope": "str", - "creationDate": "2020-02-20 00:00:00", - "dataEndpointEnabled": bool, - "dataEndpointHostNames": ["str"], - "encryption": { - "keyVaultProperties": { - "identity": "str", - "keyIdentifier": "str", - "keyRotationEnabled": bool, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", - "versionedKeyIdentifier": "str", - }, - "status": "str", - }, "id": "str", "identity": { "principalId": "str", @@ -99,44 +45,64 @@ def test_registries_begin_create(self, resource_group): "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "loginServer": "str", "name": "str", - "networkRuleBypassAllowedForTasks": False, - "networkRuleBypassOptions": "str", - "networkRuleSet": {"defaultAction": "Allow", "ipRules": [{"value": "str", "action": "Allow"}]}, - "policies": { - "azureADAuthenticationAsArmPolicy": {"status": "enabled"}, - "exportPolicy": {"status": "enabled"}, - "quarantinePolicy": {"status": "str"}, - "retentionPolicy": {"days": 7, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, - "trustPolicy": {"status": "str", "type": "Notary"}, - }, - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", - }, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", + "properties": { + "adminUserEnabled": bool, + "anonymousPullEnabled": bool, + "creationDate": "2020-02-20 00:00:00", + "dataEndpointEnabled": bool, + "dataEndpointHostNames": ["str"], + "encryption": { + "keyVaultProperties": { + "identity": "str", + "keyIdentifier": "str", + "keyRotationEnabled": bool, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "versionedKeyIdentifier": "str", }, - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "str", - "roleAssignmentMode": "str", - "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "status": "str", + }, + "loginServer": "str", + "networkRuleBypassAllowedForTasks": bool, + "networkRuleBypassOptions": "str", + "networkRuleSet": {"defaultAction": "str", "ipRules": [{"value": "str", "action": "str"}]}, + "policies": { + "azureADAuthenticationAsArmPolicy": {"status": "str"}, + "exportPolicy": {"status": "str"}, + "quarantinePolicy": {"status": "str"}, + "retentionPolicy": {"days": 0, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, + "trustPolicy": {"status": "str", "type": "str"}, + }, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "roleAssignmentMode": "str", + "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "zoneRedundancy": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -147,9 +113,7 @@ def test_registries_begin_create(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "zoneRedundancy": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -162,41 +126,42 @@ def test_registries_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", registry_update_parameters={ - "adminUserEnabled": bool, - "anonymousPullEnabled": bool, - "dataEndpointEnabled": bool, - "encryption": { - "keyVaultProperties": { - "identity": "str", - "keyIdentifier": "str", - "keyRotationEnabled": bool, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", - "versionedKeyIdentifier": "str", - }, - "status": "str", - }, "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "networkRuleBypassAllowedForTasks": bool, - "networkRuleBypassOptions": "str", - "networkRuleSet": {"defaultAction": "Allow", "ipRules": [{"value": "str", "action": "Allow"}]}, - "policies": { - "azureADAuthenticationAsArmPolicy": {"status": "enabled"}, - "exportPolicy": {"status": "enabled"}, - "quarantinePolicy": {"status": "str"}, - "retentionPolicy": {"days": 7, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, - "trustPolicy": {"status": "str", "type": "Notary"}, + "properties": { + "adminUserEnabled": bool, + "anonymousPullEnabled": bool, + "dataEndpointEnabled": bool, + "encryption": { + "keyVaultProperties": { + "identity": "str", + "keyIdentifier": "str", + "keyRotationEnabled": bool, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "versionedKeyIdentifier": "str", + }, + "status": "str", + }, + "networkRuleBypassAllowedForTasks": bool, + "networkRuleBypassOptions": "str", + "networkRuleSet": {"defaultAction": "str", "ipRules": [{"value": "str", "action": "str"}]}, + "policies": { + "azureADAuthenticationAsArmPolicy": {"status": "str"}, + "exportPolicy": {"status": "str"}, + "quarantinePolicy": {"status": "str"}, + "retentionPolicy": {"days": 0, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, + "trustPolicy": {"status": "str", "type": "str"}, + }, + "publicNetworkAccess": "str", + "roleAssignmentMode": "str", }, - "publicNetworkAccess": "str", - "roleAssignmentMode": "str", "sku": {"name": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -208,7 +173,6 @@ def test_registries_begin_delete(self, resource_group): response = self.client.registries.begin_delete( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -216,14 +180,19 @@ def test_registries_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_begin_generate_credentials(self, resource_group): - response = self.client.registries.begin_generate_credentials( + def test_registries_list_by_resource_group(self, resource_group): + response = self.client.registries.list_by_resource_group( resource_group_name=resource_group.name, - registry_name="str", - generate_credentials_parameters={"expiry": "2020-02-20 00:00:00", "name": "str", "tokenId": "str"}, - api_version="2025-11-01", - ).result() # call '.result()' to poll until service return final result + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_registries_list(self, resource_group): + response = self.client.registries.list() + result = [r for r in response] # please add some check logic here by yourself # ... @@ -240,11 +209,10 @@ def test_registries_begin_import_image(self, resource_group): "registryUri": "str", "resourceId": "str", }, - "mode": "NoForce", + "mode": "str", "targetTags": ["str"], "untaggedTargetRepositories": ["str"], }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -252,11 +220,10 @@ def test_registries_begin_import_image(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_list_credentials(self, resource_group): - response = self.client.registries.list_credentials( + def test_registries_list_usages(self, resource_group): + response = self.client.registries.list_usages( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -264,11 +231,10 @@ def test_registries_list_credentials(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_list_usages(self, resource_group): - response = self.client.registries.list_usages( + def test_registries_list_credentials(self, resource_group): + response = self.client.registries.list_credentials( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -276,37 +242,33 @@ def test_registries_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_list_private_link_resources(self, resource_group): - response = self.client.registries.list_private_link_resources( + def test_registries_regenerate_credential(self, resource_group): + response = self.client.registries.regenerate_credential( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", + regenerate_credential_parameters={"name": "str"}, ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_get_private_link_resource(self, resource_group): - response = self.client.registries.get_private_link_resource( + def test_registries_begin_generate_credentials(self, resource_group): + response = self.client.registries.begin_generate_credentials( resource_group_name=resource_group.name, registry_name="str", - group_name="str", - api_version="2025-11-01", - ) + generate_credentials_parameters={"expiry": "2020-02-20 00:00:00", "name": "str", "tokenId": "str"}, + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_regenerate_credential(self, resource_group): - response = self.client.registries.regenerate_credential( - resource_group_name=resource_group.name, - registry_name="str", - regenerate_credential_parameters={"name": "str"}, - api_version="2025-11-01", + def test_registries_check_name_availability(self, resource_group): + response = self.client.registries.check_name_availability( + registry_name_check_request={"name": "str", "type": "str"}, ) # please add some check logic here by yourself @@ -314,11 +276,11 @@ def test_registries_regenerate_credential(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_get_build_source_upload_url(self, resource_group): - response = self.client.registries.get_build_source_upload_url( + def test_registries_get_private_link_resource(self, resource_group): + response = self.client.registries.get_private_link_resource( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-03-01-preview", + group_name="str", ) # please add some check logic here by yourself @@ -326,38 +288,11 @@ def test_registries_get_build_source_upload_url(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_registries_schedule_run(self, resource_group): - response = self.client.registries.schedule_run( + def test_registries_list_private_link_resources(self, resource_group): + response = self.client.registries.list_private_link_resources( resource_group_name=resource_group.name, registry_name="str", - run_request={ - "dockerFilePath": "str", - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "type": "DockerBuildRequest", - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "arguments": [{"name": "str", "value": "str", "isSecret": False}], - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "imageNames": ["str"], - "isArchiveEnabled": False, - "isPushEnabled": True, - "logTemplate": "str", - "noCache": False, - "sourceLocation": "str", - "target": "str", - "timeout": 3600, - }, - api_version="2025-03-01-preview", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py similarity index 54% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py index 810ed61a9453..f1457a5758f3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,46 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementRegistriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryRegistriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_registries_check_name_availability(self, resource_group): - response = await self.client.registries.check_name_availability( - registry_name_check_request={ - "name": "str", - "type": "Microsoft.ContainerRegistry/registries", - "autoGeneratedDomainNameLabelScope": "str", - "resourceGroupName": "str", - }, - api_version="2025-11-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_registries_list(self, resource_group): - response = self.client.registries.list( - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_registries_list_by_resource_group(self, resource_group): - response = self.client.registries.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -62,7 +25,6 @@ async def test_registries_get(self, resource_group): response = await self.client.registries.get( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -78,22 +40,6 @@ async def test_registries_begin_create(self, resource_group): registry={ "location": "str", "sku": {"name": "str", "tier": "str"}, - "adminUserEnabled": False, - "anonymousPullEnabled": False, - "autoGeneratedDomainNameLabelScope": "str", - "creationDate": "2020-02-20 00:00:00", - "dataEndpointEnabled": bool, - "dataEndpointHostNames": ["str"], - "encryption": { - "keyVaultProperties": { - "identity": "str", - "keyIdentifier": "str", - "keyRotationEnabled": bool, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", - "versionedKeyIdentifier": "str", - }, - "status": "str", - }, "id": "str", "identity": { "principalId": "str", @@ -101,44 +47,64 @@ async def test_registries_begin_create(self, resource_group): "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "loginServer": "str", "name": "str", - "networkRuleBypassAllowedForTasks": False, - "networkRuleBypassOptions": "str", - "networkRuleSet": {"defaultAction": "Allow", "ipRules": [{"value": "str", "action": "Allow"}]}, - "policies": { - "azureADAuthenticationAsArmPolicy": {"status": "enabled"}, - "exportPolicy": {"status": "enabled"}, - "quarantinePolicy": {"status": "str"}, - "retentionPolicy": {"days": 7, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, - "trustPolicy": {"status": "str", "type": "Notary"}, - }, - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "actionsRequired": "str", - "description": "str", - "status": "str", + "properties": { + "adminUserEnabled": bool, + "anonymousPullEnabled": bool, + "creationDate": "2020-02-20 00:00:00", + "dataEndpointEnabled": bool, + "dataEndpointHostNames": ["str"], + "encryption": { + "keyVaultProperties": { + "identity": "str", + "keyIdentifier": "str", + "keyRotationEnabled": bool, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "versionedKeyIdentifier": "str", }, - "provisioningState": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - } - ], - "provisioningState": "str", - "publicNetworkAccess": "str", - "roleAssignmentMode": "str", - "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "status": "str", + }, + "loginServer": "str", + "networkRuleBypassAllowedForTasks": bool, + "networkRuleBypassOptions": "str", + "networkRuleSet": {"defaultAction": "str", "ipRules": [{"value": "str", "action": "str"}]}, + "policies": { + "azureADAuthenticationAsArmPolicy": {"status": "str"}, + "exportPolicy": {"status": "str"}, + "quarantinePolicy": {"status": "str"}, + "retentionPolicy": {"days": 0, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, + "trustPolicy": {"status": "str", "type": "str"}, + }, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateEndpoint": {"id": "str"}, + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + "roleAssignmentMode": "str", + "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "zoneRedundancy": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -149,9 +115,7 @@ async def test_registries_begin_create(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "zoneRedundancy": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -166,41 +130,42 @@ async def test_registries_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", registry_update_parameters={ - "adminUserEnabled": bool, - "anonymousPullEnabled": bool, - "dataEndpointEnabled": bool, - "encryption": { - "keyVaultProperties": { - "identity": "str", - "keyIdentifier": "str", - "keyRotationEnabled": bool, - "lastKeyRotationTimestamp": "2020-02-20 00:00:00", - "versionedKeyIdentifier": "str", - }, - "status": "str", - }, "identity": { "principalId": "str", "tenantId": "str", "type": "str", "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, - "networkRuleBypassAllowedForTasks": bool, - "networkRuleBypassOptions": "str", - "networkRuleSet": {"defaultAction": "Allow", "ipRules": [{"value": "str", "action": "Allow"}]}, - "policies": { - "azureADAuthenticationAsArmPolicy": {"status": "enabled"}, - "exportPolicy": {"status": "enabled"}, - "quarantinePolicy": {"status": "str"}, - "retentionPolicy": {"days": 7, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, - "trustPolicy": {"status": "str", "type": "Notary"}, + "properties": { + "adminUserEnabled": bool, + "anonymousPullEnabled": bool, + "dataEndpointEnabled": bool, + "encryption": { + "keyVaultProperties": { + "identity": "str", + "keyIdentifier": "str", + "keyRotationEnabled": bool, + "lastKeyRotationTimestamp": "2020-02-20 00:00:00", + "versionedKeyIdentifier": "str", + }, + "status": "str", + }, + "networkRuleBypassAllowedForTasks": bool, + "networkRuleBypassOptions": "str", + "networkRuleSet": {"defaultAction": "str", "ipRules": [{"value": "str", "action": "str"}]}, + "policies": { + "azureADAuthenticationAsArmPolicy": {"status": "str"}, + "exportPolicy": {"status": "str"}, + "quarantinePolicy": {"status": "str"}, + "retentionPolicy": {"days": 0, "lastUpdatedTime": "2020-02-20 00:00:00", "status": "str"}, + "trustPolicy": {"status": "str", "type": "str"}, + }, + "publicNetworkAccess": "str", + "roleAssignmentMode": "str", }, - "publicNetworkAccess": "str", - "roleAssignmentMode": "str", "sku": {"name": "str", "tier": "str"}, "tags": {"str": "str"}, }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -214,7 +179,6 @@ async def test_registries_begin_delete(self, resource_group): await self.client.registries.begin_delete( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -223,16 +187,19 @@ async def test_registries_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_begin_generate_credentials(self, resource_group): - response = await ( - await self.client.registries.begin_generate_credentials( - resource_group_name=resource_group.name, - registry_name="str", - generate_credentials_parameters={"expiry": "2020-02-20 00:00:00", "name": "str", "tokenId": "str"}, - api_version="2025-11-01", - ) - ).result() # call '.result()' to poll until service return final result + async def test_registries_list_by_resource_group(self, resource_group): + response = self.client.registries.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_registries_list(self, resource_group): + response = self.client.registries.list() + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -250,11 +217,10 @@ async def test_registries_begin_import_image(self, resource_group): "registryUri": "str", "resourceId": "str", }, - "mode": "NoForce", + "mode": "str", "targetTags": ["str"], "untaggedTargetRepositories": ["str"], }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -263,11 +229,10 @@ async def test_registries_begin_import_image(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_list_credentials(self, resource_group): - response = await self.client.registries.list_credentials( + async def test_registries_list_usages(self, resource_group): + response = await self.client.registries.list_usages( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -275,11 +240,10 @@ async def test_registries_list_credentials(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_list_usages(self, resource_group): - response = await self.client.registries.list_usages( + async def test_registries_list_credentials(self, resource_group): + response = await self.client.registries.list_credentials( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -287,37 +251,35 @@ async def test_registries_list_usages(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_list_private_link_resources(self, resource_group): - response = self.client.registries.list_private_link_resources( + async def test_registries_regenerate_credential(self, resource_group): + response = await self.client.registries.regenerate_credential( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-11-01", + regenerate_credential_parameters={"name": "str"}, ) - result = [r async for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_get_private_link_resource(self, resource_group): - response = await self.client.registries.get_private_link_resource( - resource_group_name=resource_group.name, - registry_name="str", - group_name="str", - api_version="2025-11-01", - ) + async def test_registries_begin_generate_credentials(self, resource_group): + response = await ( + await self.client.registries.begin_generate_credentials( + resource_group_name=resource_group.name, + registry_name="str", + generate_credentials_parameters={"expiry": "2020-02-20 00:00:00", "name": "str", "tokenId": "str"}, + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_regenerate_credential(self, resource_group): - response = await self.client.registries.regenerate_credential( - resource_group_name=resource_group.name, - registry_name="str", - regenerate_credential_parameters={"name": "str"}, - api_version="2025-11-01", + async def test_registries_check_name_availability(self, resource_group): + response = await self.client.registries.check_name_availability( + registry_name_check_request={"name": "str", "type": "str"}, ) # please add some check logic here by yourself @@ -325,11 +287,11 @@ async def test_registries_regenerate_credential(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_get_build_source_upload_url(self, resource_group): - response = await self.client.registries.get_build_source_upload_url( + async def test_registries_get_private_link_resource(self, resource_group): + response = await self.client.registries.get_private_link_resource( resource_group_name=resource_group.name, registry_name="str", - api_version="2025-03-01-preview", + group_name="str", ) # please add some check logic here by yourself @@ -337,38 +299,11 @@ async def test_registries_get_build_source_upload_url(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_registries_schedule_run(self, resource_group): - response = await self.client.registries.schedule_run( + async def test_registries_list_private_link_resources(self, resource_group): + response = self.client.registries.list_private_link_resources( resource_group_name=resource_group.name, registry_name="str", - run_request={ - "dockerFilePath": "str", - "platform": {"os": "str", "architecture": "str", "variant": "str"}, - "type": "DockerBuildRequest", - "agentConfiguration": {"cpu": 0}, - "agentPoolName": "str", - "arguments": [{"name": "str", "value": "str", "isSecret": False}], - "credentials": { - "customRegistries": { - "str": { - "identity": "str", - "password": {"type": "str", "value": "str"}, - "userName": {"type": "str", "value": "str"}, - } - }, - "sourceRegistry": {"identity": "str", "loginMode": "str"}, - }, - "imageNames": ["str"], - "isArchiveEnabled": False, - "isPushEnabled": True, - "logTemplate": "str", - "noCache": False, - "sourceLocation": "str", - "target": "str", - "timeout": 3600, - }, - api_version="2025-03-01-preview", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py similarity index 80% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py index d3c61f602d79..06a262c58e3a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementReplicationsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryReplicationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_replications_list(self, resource_group): - response = self.client.replications.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_replications_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -54,9 +41,12 @@ def test_replications_begin_create(self, resource_group): "location": "str", "id": "str", "name": "str", - "provisioningState": "str", - "regionEndpointEnabled": True, - "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "properties": { + "provisioningState": "str", + "regionEndpointEnabled": bool, + "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "zoneRedundancy": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -67,9 +57,7 @@ def test_replications_begin_create(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "zoneRedundancy": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -82,8 +70,7 @@ def test_replications_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - replication_update_parameters={"regionEndpointEnabled": bool, "tags": {"str": "str"}}, - api_version="2025-11-01", + replication_update_parameters={"properties": {"regionEndpointEnabled": bool}, "tags": {"str": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -96,8 +83,18 @@ def test_replications_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_replications_list(self, resource_group): + response = self.client.replications.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py index 83f547108987..a645737b1050 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementReplicationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryReplicationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_replications_list(self, resource_group): - response = self.client.replications.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_replications_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -56,9 +43,12 @@ async def test_replications_begin_create(self, resource_group): "location": "str", "id": "str", "name": "str", - "provisioningState": "str", - "regionEndpointEnabled": True, - "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "properties": { + "provisioningState": "str", + "regionEndpointEnabled": bool, + "status": {"displayStatus": "str", "message": "str", "timestamp": "2020-02-20 00:00:00"}, + "zoneRedundancy": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -69,9 +59,7 @@ async def test_replications_begin_create(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "zoneRedundancy": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -86,8 +74,7 @@ async def test_replications_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - replication_update_parameters={"regionEndpointEnabled": bool, "tags": {"str": "str"}}, - api_version="2025-11-01", + replication_update_parameters={"properties": {"regionEndpointEnabled": bool}, "tags": {"str": "str"}}, ) ).result() # call '.result()' to poll until service return final result @@ -102,9 +89,19 @@ async def test_replications_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", replication_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_replications_list(self, resource_group): + response = self.client.replications.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py index 995b759c07d9..7cb76ae02400 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementScopeMapsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryScopeMapsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_scope_maps_list(self, resource_group): - response = self.client.scope_maps.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_scope_maps_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -51,12 +38,15 @@ def test_scope_maps_begin_create(self, resource_group): registry_name="str", scope_map_name="str", scope_map_create_parameters={ - "actions": ["str"], - "creationDate": "2020-02-20 00:00:00", - "description": "str", "id": "str", "name": "str", - "provisioningState": "str", + "properties": { + "actions": ["str"], + "creationDate": "2020-02-20 00:00:00", + "description": "str", + "provisioningState": "str", + "type": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -67,7 +57,6 @@ def test_scope_maps_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -80,8 +69,7 @@ def test_scope_maps_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - scope_map_update_parameters={"actions": ["str"], "description": "str"}, - api_version="2025-11-01", + scope_map_update_parameters={"properties": {"actions": ["str"], "description": "str"}}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,8 +82,18 @@ def test_scope_maps_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_scope_maps_list(self, resource_group): + response = self.client.scope_maps.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py similarity index 82% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py index aa49569c58aa..5173e971bc97 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementScopeMapsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryScopeMapsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_scope_maps_list(self, resource_group): - response = self.client.scope_maps.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_scope_maps_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,12 +40,15 @@ async def test_scope_maps_begin_create(self, resource_group): registry_name="str", scope_map_name="str", scope_map_create_parameters={ - "actions": ["str"], - "creationDate": "2020-02-20 00:00:00", - "description": "str", "id": "str", "name": "str", - "provisioningState": "str", + "properties": { + "actions": ["str"], + "creationDate": "2020-02-20 00:00:00", + "description": "str", + "provisioningState": "str", + "type": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -69,7 +59,6 @@ async def test_scope_maps_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -84,8 +73,7 @@ async def test_scope_maps_begin_update(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - scope_map_update_parameters={"actions": ["str"], "description": "str"}, - api_version="2025-11-01", + scope_map_update_parameters={"properties": {"actions": ["str"], "description": "str"}}, ) ).result() # call '.result()' to poll until service return final result @@ -100,9 +88,19 @@ async def test_scope_maps_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", scope_map_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_scope_maps_list(self, resource_group): + response = self.client.scope_maps.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py similarity index 61% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py index 774a8d0b2ec1..87de2dd094bb 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTokensOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryTokensOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tokens_list(self, resource_group): - response = self.client.tokens.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_tokens_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", token_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -51,30 +38,32 @@ def test_tokens_begin_create(self, resource_group): registry_name="str", token_name="str", token_create_parameters={ - "creationDate": "2020-02-20 00:00:00", - "credentials": { - "certificates": [ - { - "encodedPemCertificate": "str", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "thumbprint": "str", - } - ], - "passwords": [ - { - "creationTime": "2020-02-20 00:00:00", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "value": "str", - } - ], - }, "id": "str", "name": "str", - "provisioningState": "str", - "scopeMapId": "str", - "status": "str", + "properties": { + "creationDate": "2020-02-20 00:00:00", + "credentials": { + "certificates": [ + { + "encodedPemCertificate": "str", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "thumbprint": "str", + } + ], + "passwords": [ + { + "creationTime": "2020-02-20 00:00:00", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "value": "str", + } + ], + }, + "provisioningState": "str", + "scopeMapId": "str", + "status": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -85,7 +74,6 @@ def test_tokens_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -99,28 +87,29 @@ def test_tokens_begin_update(self, resource_group): registry_name="str", token_name="str", token_update_parameters={ - "credentials": { - "certificates": [ - { - "encodedPemCertificate": "str", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "thumbprint": "str", - } - ], - "passwords": [ - { - "creationTime": "2020-02-20 00:00:00", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "value": "str", - } - ], - }, - "scopeMapId": "str", - "status": "str", + "properties": { + "credentials": { + "certificates": [ + { + "encodedPemCertificate": "str", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "thumbprint": "str", + } + ], + "passwords": [ + { + "creationTime": "2020-02-20 00:00:00", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "value": "str", + } + ], + }, + "scopeMapId": "str", + "status": "str", + } }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -133,8 +122,18 @@ def test_tokens_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", token_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_tokens_list(self, resource_group): + response = self.client.tokens.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py similarity index 61% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py index fe4190c843ba..27e1fad3e583 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementTokensOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryTokensOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tokens_list(self, resource_group): - response = self.client.tokens.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_tokens_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", token_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -53,30 +40,32 @@ async def test_tokens_begin_create(self, resource_group): registry_name="str", token_name="str", token_create_parameters={ - "creationDate": "2020-02-20 00:00:00", - "credentials": { - "certificates": [ - { - "encodedPemCertificate": "str", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "thumbprint": "str", - } - ], - "passwords": [ - { - "creationTime": "2020-02-20 00:00:00", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "value": "str", - } - ], - }, "id": "str", "name": "str", - "provisioningState": "str", - "scopeMapId": "str", - "status": "str", + "properties": { + "creationDate": "2020-02-20 00:00:00", + "credentials": { + "certificates": [ + { + "encodedPemCertificate": "str", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "thumbprint": "str", + } + ], + "passwords": [ + { + "creationTime": "2020-02-20 00:00:00", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "value": "str", + } + ], + }, + "provisioningState": "str", + "scopeMapId": "str", + "status": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,7 +76,6 @@ async def test_tokens_begin_create(self, resource_group): }, "type": "str", }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -103,28 +91,29 @@ async def test_tokens_begin_update(self, resource_group): registry_name="str", token_name="str", token_update_parameters={ - "credentials": { - "certificates": [ - { - "encodedPemCertificate": "str", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "thumbprint": "str", - } - ], - "passwords": [ - { - "creationTime": "2020-02-20 00:00:00", - "expiry": "2020-02-20 00:00:00", - "name": "str", - "value": "str", - } - ], - }, - "scopeMapId": "str", - "status": "str", + "properties": { + "credentials": { + "certificates": [ + { + "encodedPemCertificate": "str", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "thumbprint": "str", + } + ], + "passwords": [ + { + "creationTime": "2020-02-20 00:00:00", + "expiry": "2020-02-20 00:00:00", + "name": "str", + "value": "str", + } + ], + }, + "scopeMapId": "str", + "status": "str", + } }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -139,9 +128,19 @@ async def test_tokens_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", token_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_tokens_list(self, resource_group): + response = self.client.tokens.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py index ff9529ce3d35..73e36a4c86d0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryManagementClient +from azure.mgmt.containerregistry import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,21 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementWebhooksOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryWebhooksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_webhooks_list(self, resource_group): - response = self.client.webhooks.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -37,7 +25,6 @@ def test_webhooks_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -52,14 +39,15 @@ def test_webhooks_begin_create(self, resource_group): webhook_name="str", webhook_create_parameters={ "location": "str", - "actions": ["str"], - "customHeaders": {"str": "str"}, - "scope": "str", - "serviceUri": "str", - "status": "str", + "properties": { + "actions": ["str"], + "serviceUri": "str", + "customHeaders": {"str": "str"}, + "scope": "str", + "status": "str", + }, "tags": {"str": "str"}, }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -73,14 +61,15 @@ def test_webhooks_begin_update(self, resource_group): registry_name="str", webhook_name="str", webhook_update_parameters={ - "actions": ["str"], - "customHeaders": {"str": "str"}, - "scope": "str", - "serviceUri": "str", - "status": "str", + "properties": { + "actions": ["str"], + "customHeaders": {"str": "str"}, + "scope": "str", + "serviceUri": "str", + "status": "str", + }, "tags": {"str": "str"}, }, - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -93,7 +82,6 @@ def test_webhooks_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -101,12 +89,22 @@ def test_webhooks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhooks_get_callback_config(self, resource_group): - response = self.client.webhooks.get_callback_config( + def test_webhooks_list(self, resource_group): + response = self.client.webhooks.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_webhooks_ping(self, resource_group): + response = self.client.webhooks.ping( resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -119,7 +117,6 @@ def test_webhooks_list_events(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -127,12 +124,11 @@ def test_webhooks_list_events(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_webhooks_ping(self, resource_group): - response = self.client.webhooks.ping( + def test_webhooks_get_callback_config(self, resource_group): + response = self.client.webhooks.get_callback_config( resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py index da6d9e306e78..66b4f1b40bf9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py @@ -2,11 +2,11 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient +from azure.mgmt.containerregistry.aio import ContainerRegistryClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,21 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryManagementWebhooksOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryWebhooksOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_webhooks_list(self, resource_group): - response = self.client.webhooks.list( - resource_group_name=resource_group.name, - registry_name="str", - api_version="2025-11-01", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... + self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -38,7 +26,6 @@ async def test_webhooks_get(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -54,14 +41,15 @@ async def test_webhooks_begin_create(self, resource_group): webhook_name="str", webhook_create_parameters={ "location": "str", - "actions": ["str"], - "customHeaders": {"str": "str"}, - "scope": "str", - "serviceUri": "str", - "status": "str", + "properties": { + "actions": ["str"], + "serviceUri": "str", + "customHeaders": {"str": "str"}, + "scope": "str", + "status": "str", + }, "tags": {"str": "str"}, }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -77,14 +65,15 @@ async def test_webhooks_begin_update(self, resource_group): registry_name="str", webhook_name="str", webhook_update_parameters={ - "actions": ["str"], - "customHeaders": {"str": "str"}, - "scope": "str", - "serviceUri": "str", - "status": "str", + "properties": { + "actions": ["str"], + "customHeaders": {"str": "str"}, + "scope": "str", + "serviceUri": "str", + "status": "str", + }, "tags": {"str": "str"}, }, - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -99,7 +88,6 @@ async def test_webhooks_begin_delete(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) ).result() # call '.result()' to poll until service return final result @@ -108,12 +96,22 @@ async def test_webhooks_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhooks_get_callback_config(self, resource_group): - response = await self.client.webhooks.get_callback_config( + async def test_webhooks_list(self, resource_group): + response = self.client.webhooks.list( + resource_group_name=resource_group.name, + registry_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_webhooks_ping(self, resource_group): + response = await self.client.webhooks.ping( resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself @@ -126,7 +124,6 @@ async def test_webhooks_list_events(self, resource_group): resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -134,12 +131,11 @@ async def test_webhooks_list_events(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_webhooks_ping(self, resource_group): - response = await self.client.webhooks.ping( + async def test_webhooks_get_callback_config(self, resource_group): + response = await self.client.webhooks.get_callback_config( resource_group_name=resource_group.name, registry_name="str", webhook_name="str", - api_version="2025-11-01", ) # please add some check logic here by yourself diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml b/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml index e5e7aeaaab04..0568f4bca743 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml +++ b/sdk/containerregistry/azure-mgmt-containerregistry/pyproject.toml @@ -13,7 +13,7 @@ authors = [ description = "Microsoft Azure Containerregistry Management Client Library for Python" license = "MIT" classifiers = [ - "Development Status :: 4 - Beta", + "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", @@ -79,7 +79,7 @@ verifytypes = false package_name = "azure-mgmt-containerregistry" package_pprint_name = "Container Registry" package_doc_id = "container-registry" -is_stable = false +is_stable = true is_arm = true sample_link = "" title = "ContainerRegistryManagementClient" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry.py b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry.py index 0665a40955de..f8535ccecb80 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_registry.py b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_registry.py index 3808d0b74ec6..109826111edc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_registry.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_registry.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_task.py b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_task.py index 68fa9b09b3b7..b28154c0ef3d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_task.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/tests/disable_test_cli_mgmt_containerregistry_task.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml b/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml new file mode 100644 index 000000000000..c401729cef54 --- /dev/null +++ b/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry +commit: eb320d1d85f5b46c3cfe6cf60a1f0de4ef3b01d9 +repo: Azure/azure-rest-api-specs +additionalDirectories: From b491b490f7a840344751150de3ad53006e528d40 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 22 Jan 2026 06:09:33 +0000 Subject: [PATCH 2/3] Configurations: 'specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry/tspconfig.yaml', API Version: 2025-11-01, SDK Release Type: stable, and CommitSHA: '9e837dc0b9ac5fa4a798367b6560336cb7ca28d3' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=5783027 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-containerregistry/CHANGELOG.md | 82 +++++++ .../_metadata.json | 2 +- .../azure/mgmt/containerregistry/__init__.py | 4 +- .../azure/mgmt/containerregistry/_client.py | 6 +- .../mgmt/containerregistry/_configuration.py | 4 +- .../mgmt/containerregistry/aio/__init__.py | 4 +- .../mgmt/containerregistry/aio/_client.py | 6 +- .../containerregistry/aio/_configuration.py | 4 +- .../aio/operations/_operations.py | 62 +++-- .../mgmt/containerregistry/models/_models.py | 218 ++++++++++++++++++ .../operations/_operations.py | 62 +++-- .../generated_samples/cache_rule_create.py | 4 +- .../generated_samples/cache_rule_delete.py | 4 +- .../generated_samples/cache_rule_get.py | 4 +- .../generated_samples/cache_rule_list.py | 4 +- .../generated_samples/cache_rule_update.py | 4 +- .../connected_registry_create.py | 4 +- .../connected_registry_deactivate.py | 4 +- .../connected_registry_delete.py | 4 +- .../connected_registry_get.py | 4 +- .../connected_registry_list.py | 4 +- .../connected_registry_update.py | 4 +- .../credential_set_create.py | 4 +- .../credential_set_delete.py | 4 +- .../generated_samples/credential_set_get.py | 4 +- .../generated_samples/credential_set_list.py | 4 +- .../credential_set_update.py | 4 +- .../import_image_by_manifest_digest.py | 4 +- .../generated_samples/import_image_by_tag.py | 4 +- .../import_image_from_public_registry.py | 4 +- .../generated_samples/operation_list.py | 4 +- ...te_endpoint_connection_create_or_update.py | 4 +- .../private_endpoint_connection_delete.py | 4 +- .../private_endpoint_connection_get.py | 4 +- .../private_endpoint_connection_list.py | 4 +- .../registry_check_name_available.py | 4 +- .../registry_check_name_not_available.py | 4 +- .../generated_samples/registry_create.py | 4 +- .../generated_samples/registry_create_abac.py | 4 +- .../registry_create_zone_redundant.py | 4 +- .../generated_samples/registry_delete.py | 4 +- .../registry_generate_credentials.py | 4 +- .../generated_samples/registry_get.py | 4 +- .../registry_get_private_link_resource.py | 4 +- .../generated_samples/registry_list.py | 4 +- .../registry_list_by_resource_group.py | 4 +- .../registry_list_credentials.py | 4 +- .../registry_list_private_link_resources.py | 4 +- .../generated_samples/registry_list_usages.py | 4 +- .../registry_regenerate_credential.py | 4 +- .../generated_samples/registry_update.py | 4 +- .../generated_samples/replication_create.py | 4 +- .../replication_create_zone_redundant.py | 4 +- .../generated_samples/replication_delete.py | 4 +- .../generated_samples/replication_get.py | 4 +- .../generated_samples/replication_list.py | 4 +- .../generated_samples/replication_update.py | 4 +- .../generated_samples/scope_map_create.py | 4 +- .../generated_samples/scope_map_delete.py | 4 +- .../generated_samples/scope_map_get.py | 4 +- .../generated_samples/scope_map_list.py | 4 +- .../generated_samples/scope_map_update.py | 4 +- .../generated_samples/token_create.py | 4 +- .../generated_samples/token_delete.py | 4 +- .../generated_samples/token_get.py | 4 +- .../generated_samples/token_list.py | 4 +- .../generated_samples/token_update.py | 4 +- .../generated_samples/webhook_create.py | 4 +- .../generated_samples/webhook_delete.py | 4 +- .../generated_samples/webhook_get.py | 4 +- .../webhook_get_callback_config.py | 4 +- .../generated_samples/webhook_list.py | 4 +- .../generated_samples/webhook_list_events.py | 4 +- .../generated_samples/webhook_ping.py | 4 +- .../generated_samples/webhook_update.py | 4 +- .../generated_tests/conftest.py | 28 ++- ...stry_management_cache_rules_operations.py} | 6 +- ...anagement_cache_rules_operations_async.py} | 6 +- ...gement_connected_registries_operations.py} | 6 +- ..._connected_registries_operations_async.py} | 6 +- ..._management_credential_sets_operations.py} | 6 +- ...ement_credential_sets_operations_async.py} | 6 +- ...ntainer_registry_management_operations.py} | 6 +- ...r_registry_management_operations_async.py} | 6 +- ...rivate_endpoint_connections_operations.py} | 6 +- ..._endpoint_connections_operations_async.py} | 6 +- ...istry_management_registries_operations.py} | 6 +- ...management_registries_operations_async.py} | 6 +- ...try_management_replications_operations.py} | 6 +- ...nagement_replications_operations_async.py} | 6 +- ...istry_management_scope_maps_operations.py} | 6 +- ...management_scope_maps_operations_async.py} | 6 +- ..._registry_management_tokens_operations.py} | 6 +- ...try_management_tokens_operations_async.py} | 6 +- ...egistry_management_webhooks_operations.py} | 6 +- ...y_management_webhooks_operations_async.py} | 6 +- .../tsp-location.yaml | 2 +- 97 files changed, 606 insertions(+), 254 deletions(-) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_cache_rules_operations.py => test_container_registry_management_cache_rules_operations.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_cache_rules_operations_async.py => test_container_registry_management_cache_rules_operations_async.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_connected_registries_operations.py => test_container_registry_management_connected_registries_operations.py} (96%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_connected_registries_operations_async.py => test_container_registry_management_connected_registries_operations_async.py} (96%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_credential_sets_operations.py => test_container_registry_management_credential_sets_operations.py} (95%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_credential_sets_operations_async.py => test_container_registry_management_credential_sets_operations_async.py} (95%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_operations.py => test_container_registry_management_operations.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_operations_async.py => test_container_registry_management_operations_async.py} (81%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_private_endpoint_connections_operations.py => test_container_registry_management_private_endpoint_connections_operations.py} (93%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_private_endpoint_connections_operations_async.py => test_container_registry_management_private_endpoint_connections_operations_async.py} (93%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_registries_operations.py => test_container_registry_management_registries_operations.py} (98%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_registries_operations_async.py => test_container_registry_management_registries_operations_async.py} (98%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_replications_operations.py => test_container_registry_management_replications_operations.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_replications_operations_async.py => test_container_registry_management_replications_operations_async.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_scope_maps_operations.py => test_container_registry_management_scope_maps_operations.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_scope_maps_operations_async.py => test_container_registry_management_scope_maps_operations_async.py} (94%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_tokens_operations.py => test_container_registry_management_tokens_operations.py} (95%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_tokens_operations_async.py => test_container_registry_management_tokens_operations_async.py} (95%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_webhooks_operations.py => test_container_registry_management_webhooks_operations.py} (95%) rename sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/{test_container_registry_webhooks_operations_async.py => test_container_registry_management_webhooks_operations_async.py} (95%) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md index 51f0f3792f96..e44ac6ce9e2d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md @@ -1,5 +1,87 @@ # Release History +## 15.0.0 (2026-01-22) + +### Features Added + + - Model `ContainerRegistryManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `ContainerRegistryManagementClient` added method `send_request` + - Model `ConnectedRegistry` added property `properties` + - Model `CredentialSetUpdateParameters` added property `properties` + - Model `OperationDefinition` added property `properties` + - Model `PrivateLinkResource` added property `system_data` + - Model `RegistryNameCheckRequest` added property `type` + - Model `RegistryUpdateParameters` added property `properties` + - Model `WebhookCreateParameters` added property `properties` + - Model `WebhookUpdateParameters` added property `properties` + - Added model `CacheRuleUpdateProperties` + - Added enum `ContainerRegistryResourceType` + - Added model `CredentialSetUpdateProperties` + - Added model `OperationPropertiesDefinition` + - Added model `RegistryPropertiesUpdateParameters` + - Added enum `RoleAssignmentMode` + - Added model `ScopeMapPropertiesUpdateParameters` + - Added model `TokenUpdateProperties` + - Added model `TrackedResource` + - Added model `WebhookPropertiesCreateParameters` + - Added model `WebhookPropertiesUpdateParameters` + +### Breaking Changes + + - Model `CacheRuleUpdateParameters` deleted or renamed its instance variable `credential_set_resource_id` + - Model `ConnectedRegistry` deleted or renamed its instance variable `provisioning_state` + - Model `ConnectedRegistry` deleted or renamed its instance variable `mode` + - Model `ConnectedRegistry` deleted or renamed its instance variable `version` + - Model `ConnectedRegistry` deleted or renamed its instance variable `connection_state` + - Model `ConnectedRegistry` deleted or renamed its instance variable `last_activity_time` + - Model `ConnectedRegistry` deleted or renamed its instance variable `activation` + - Model `ConnectedRegistry` deleted or renamed its instance variable `parent` + - Model `ConnectedRegistry` deleted or renamed its instance variable `client_token_ids` + - Model `ConnectedRegistry` deleted or renamed its instance variable `login_server` + - Model `ConnectedRegistry` deleted or renamed its instance variable `logging` + - Model `ConnectedRegistry` deleted or renamed its instance variable `status_details` + - Model `ConnectedRegistry` deleted or renamed its instance variable `notifications_list` + - Model `ConnectedRegistry` deleted or renamed its instance variable `garbage_collection` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `sync_properties` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `logging` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `client_token_ids` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `notifications_list` + - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `garbage_collection` + - Model `CredentialSetUpdateParameters` deleted or renamed its instance variable `auth_credentials` + - Model `OperationDefinition` deleted or renamed its instance variable `service_specification` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `admin_user_enabled` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_set` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `policies` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `encryption` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `data_endpoint_enabled` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `public_network_access` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_bypass_options` + - Model `RegistryUpdateParameters` deleted or renamed its instance variable `anonymous_pull_enabled` + - Model `Resource` deleted or renamed its instance variable `location` + - Model `Resource` deleted or renamed its instance variable `tags` + - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `description` + - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `actions` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `scope_map_id` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `status` + - Model `TokenUpdateParameters` deleted or renamed its instance variable `credentials` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `service_uri` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `custom_headers` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `status` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `scope` + - Model `WebhookCreateParameters` deleted or renamed its instance variable `actions` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `service_uri` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `custom_headers` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `status` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `scope` + - Model `WebhookUpdateParameters` deleted or renamed its instance variable `actions` + - Deleted or renamed model `ActiveDirectoryObject` + - Deleted or renamed model `ConnectedRegistryPropertiesActivation` + - Deleted or renamed model `ConnectedRegistryPropertiesAutoGenerated` + - Deleted or renamed model `ConnectedRegistryUpdateParametersProperties` + - Deleted or renamed model `LastModifiedByType` + - Deleted or renamed model `PackageType` + - Deleted or renamed model `StorageAccountProperties` + ## 15.0.0 (2026-01-21) ### Features Added diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json b/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json index 5294dd51030d..72f583ef34a9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json +++ b/sdk/containerregistry/azure-mgmt-containerregistry/_metadata.json @@ -1,6 +1,6 @@ { "apiVersion": "2025-11-01", - "commit": "eb320d1d85f5b46c3cfe6cf60a1f0de4ef3b01d9", + "commit": "9e837dc0b9ac5fa4a798367b6560336cb7ca28d3", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "typespec_src": "specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry", "emitterVersion": "0.57.1" diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py index 36f67ce7b7c1..b856c8f4d48d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/__init__.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._client import ContainerRegistryClient # type: ignore +from ._client import ContainerRegistryManagementClient # type: ignore from ._version import VERSION __version__ = VERSION @@ -25,7 +25,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ContainerRegistryClient", + "ContainerRegistryManagementClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py index 531e18041ecb..b8e8ddb2a9de 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_client.py @@ -17,7 +17,7 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from ._configuration import ContainerRegistryClientConfiguration +from ._configuration import ContainerRegistryManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( CacheRulesOperations, @@ -37,7 +37,7 @@ from azure.core.credentials import TokenCredential -class ContainerRegistryClient: # pylint: disable=too-many-instance-attributes +class ContainerRegistryManagementClient: # pylint: disable=too-many-instance-attributes """The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. @@ -95,7 +95,7 @@ def __init__( if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ContainerRegistryClientConfiguration( + self._config = ContainerRegistryManagementClientConfiguration( credential=credential, subscription_id=subscription_id, base_url=cast(str, base_url), 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 2536d71cc4a8..5abeabe18ff3 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/_configuration.py @@ -18,8 +18,8 @@ from azure.core.credentials import TokenCredential -class ContainerRegistryClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ContainerRegistryClient. +class ContainerRegistryManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ContainerRegistryManagementClient. Note that all parameters used to create this instance are saved as instance attributes. diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py index dc63d9d6ff49..d75b81a26a77 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/__init__.py @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._client import ContainerRegistryClient # type: ignore +from ._client import ContainerRegistryManagementClient # type: ignore try: from ._patch import __all__ as _patch_all @@ -22,7 +22,7 @@ from ._patch import patch_sdk as _patch_sdk __all__ = [ - "ContainerRegistryClient", + "ContainerRegistryManagementClient", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_client.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_client.py index 7763060bc2f7..18b32f4f2234 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_client.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/_client.py @@ -18,7 +18,7 @@ from azure.mgmt.core.tools import get_arm_endpoints from .._utils.serialization import Deserializer, Serializer -from ._configuration import ContainerRegistryClientConfiguration +from ._configuration import ContainerRegistryManagementClientConfiguration from .operations import ( CacheRulesOperations, ConnectedRegistriesOperations, @@ -37,7 +37,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerRegistryClient: # pylint: disable=too-many-instance-attributes +class ContainerRegistryManagementClient: # pylint: disable=too-many-instance-attributes """The Microsoft Azure Container Registry management API provides create, read, update, and delete functionality for Azure Container Registry resources including registries, replications, webhooks, tasks, runs, and other registry components. @@ -95,7 +95,7 @@ def __init__( if not base_url: base_url = _endpoints["resource_manager"] credential_scopes = kwargs.pop("credential_scopes", _endpoints["credential_scopes"]) - self._config = ContainerRegistryClientConfiguration( + self._config = ContainerRegistryManagementClientConfiguration( credential=credential, subscription_id=subscription_id, base_url=cast(str, base_url), 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 020dcdc4f93d..ca3877f97ca5 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 @@ -18,8 +18,8 @@ from azure.core.credentials_async import AsyncTokenCredential -class ContainerRegistryClientConfiguration: # pylint: disable=too-many-instance-attributes - """Configuration for ContainerRegistryClient. +class ContainerRegistryManagementClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long + """Configuration for ContainerRegistryManagementClient. Note that all parameters used to create this instance are saved as instance attributes. diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py index 7e187bf5011c..89180038ea66 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/aio/operations/_operations.py @@ -96,7 +96,7 @@ build_webhooks_ping_request, build_webhooks_update_request, ) -from .._configuration import ContainerRegistryClientConfiguration +from .._configuration import ContainerRegistryManagementClientConfiguration T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] @@ -110,14 +110,16 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`operations` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -215,14 +217,16 @@ class RegistriesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`registries` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -2167,14 +2171,16 @@ class CacheRulesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`cache_rules` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -2979,14 +2985,16 @@ class CredentialSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`credential_sets` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -3800,14 +3808,16 @@ class ConnectedRegistriesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`connected_registries` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -4759,14 +4769,16 @@ class PrivateEndpointConnectionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`private_endpoint_connections` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -5335,14 +5347,16 @@ class ReplicationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`replications` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -6149,14 +6163,16 @@ class ScopeMapsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`scope_maps` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -6961,14 +6977,16 @@ class TokensOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`tokens` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -7769,14 +7787,16 @@ class WebhooksOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.aio.ContainerRegistryManagementClient`'s :attr:`webhooks` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py index 3028f1fa03d6..46be5af09a15 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/models/_models.py @@ -208,6 +208,14 @@ class CacheRule(ProxyResource): ) """The properties of the cache rule.""" + __flattened_items = [ + "credential_set_resource_id", + "source_repository", + "target_repository", + "creation_date", + "provisioning_state", + ] + @overload def __init__( self, @@ -223,7 +231,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CacheRuleProperties(_Model): @@ -424,6 +450,22 @@ class ConnectedRegistry(ProxyResource): ) """The properties of the connected registry.""" + __flattened_items = [ + "provisioning_state", + "mode", + "version", + "connection_state", + "last_activity_time", + "activation", + "parent", + "client_token_ids", + "login_server", + "logging", + "status_details", + "notifications_list", + "garbage_collection", + ] + @overload def __init__( self, @@ -439,7 +481,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ConnectedRegistryProperties(_Model): @@ -734,6 +794,8 @@ class CredentialSet(ProxyResource): ) """Identities associated with the resource. This is used to access the KeyVault secrets.""" + __flattened_items = ["login_server", "auth_credentials", "creation_date", "provisioning_state"] + @overload def __init__( self, @@ -750,7 +812,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class CredentialSetProperties(_Model): @@ -2210,6 +2290,8 @@ class PrivateEndpointConnection(ProxyResource): ) """The properties of a private endpoint connection.""" + __flattened_items = ["private_endpoint", "private_link_service_connection_state", "provisioning_state"] + @overload def __init__( self, @@ -2225,7 +2307,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class PrivateEndpointConnectionProperties(_Model): @@ -2546,6 +2646,26 @@ class Registry(TrackedResource): ) """The identity of the container registry.""" + __flattened_items = [ + "login_server", + "creation_date", + "provisioning_state", + "status", + "admin_user_enabled", + "network_rule_set", + "policies", + "encryption", + "data_endpoint_enabled", + "data_endpoint_host_names", + "private_endpoint_connections", + "public_network_access", + "network_rule_bypass_options", + "network_rule_bypass_allowed_for_tasks", + "zone_redundancy", + "anonymous_pull_enabled", + "role_assignment_mode", + ] + @overload def __init__( self, @@ -2565,7 +2685,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class RegistryListCredentialsResult(_Model): @@ -3141,6 +3279,8 @@ class Replication(TrackedResource): ) """The properties of the replication.""" + __flattened_items = ["provisioning_state", "status", "region_endpoint_enabled", "zone_redundancy"] + @overload def __init__( self, @@ -3158,7 +3298,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ReplicationProperties(_Model): @@ -3424,6 +3582,8 @@ class ScopeMap(ProxyResource): ) """The properties of the scope map.""" + __flattened_items = ["description", "type", "creation_date", "provisioning_state", "actions"] + @overload def __init__( self, @@ -3439,7 +3599,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class ScopeMapProperties(_Model): @@ -4006,6 +4184,8 @@ class Token(ProxyResource): ) """The properties of the token.""" + __flattened_items = ["creation_date", "provisioning_state", "scope_map_id", "credentials", "status"] + @overload def __init__( self, @@ -4021,7 +4201,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class TokenCertificate(_Model): @@ -4397,6 +4595,8 @@ class Webhook(TrackedResource): ) """The properties of the webhook.""" + __flattened_items = ["status", "scope", "actions", "provisioning_state"] + @overload def __init__( self, @@ -4414,7 +4614,25 @@ def __init__(self, mapping: Mapping[str, Any]) -> None: """ def __init__(self, *args: Any, **kwargs: Any) -> None: + _flattened_input = {k: kwargs.pop(k) for k in kwargs.keys() & self.__flattened_items} super().__init__(*args, **kwargs) + for k, v in _flattened_input.items(): + setattr(self, k, v) + + def __getattr__(self, name: str) -> Any: + if name in self.__flattened_items: + if self.properties is None: + return None + return getattr(self.properties, name) + raise AttributeError(f"'{self.__class__.__name__}' object has no attribute '{name}'") + + def __setattr__(self, key: str, value: Any) -> None: + if key in self.__flattened_items: + if self.properties is None: + self.properties = self._attr_to_rest_field["properties"]._class_type() + setattr(self.properties, key, value) + else: + super().__setattr__(key, value) class WebhookCreateParameters(_Model): diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py index 5a0c62f8559a..300b026a1efb 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/azure/mgmt/containerregistry/operations/_operations.py @@ -33,7 +33,7 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from .._configuration import ContainerRegistryClientConfiguration +from .._configuration import ContainerRegistryManagementClientConfiguration from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer @@ -1716,14 +1716,16 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`operations` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -1820,14 +1822,16 @@ class RegistriesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`registries` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -3769,14 +3773,16 @@ class CacheRulesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`cache_rules` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -4581,14 +4587,16 @@ class CredentialSetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`credential_sets` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -5399,14 +5407,16 @@ class ConnectedRegistriesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`connected_registries` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -6349,14 +6359,16 @@ class PrivateEndpointConnectionsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`private_endpoint_connections` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -6925,14 +6937,16 @@ class ReplicationsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`replications` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -7736,14 +7750,16 @@ class ScopeMapsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`scope_maps` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -8546,14 +8562,16 @@ class TokensOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`tokens` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @@ -9354,14 +9372,16 @@ class WebhooksOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerregistry.ContainerRegistryClient`'s + :class:`~azure.mgmt.containerregistry.ContainerRegistryManagementClient`'s :attr:`webhooks` attribute. """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") - self._config: ContainerRegistryClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._config: ContainerRegistryManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py index 2ae608351340..5bd0352062b4 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_create.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py index 2784f3aee5a4..d4b1f4e97a97 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py index e7a0bdac84fc..53b56cdeb329 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py index 6f5e968584a3..0a7de479e2be 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py index d8201ca17e7a..8e5e8369b614 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/cache_rule_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py index 5f28ebb464db..a649804ee4c8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_create.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py index bccd2d4bd4dc..ed4d651939bc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_deactivate.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py index 0ef3ede01326..02a2d32952f6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py index 462d66327fcc..0cd7aa1abb69 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py index ce113819898b..13547d4748da 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py index 0b564e647130..35dc498c5ea9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/connected_registry_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py index dac2e54e2144..500bef3b20ed 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_create.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py index 7dbefe953aff..e4f17ec4708b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py index ed676ac4589f..0f30dcf68ffb 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py index a41f18add635..3b495c659a29 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py index b61dcf16a572..ae342183c1cc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/credential_set_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py index 4d3bdc6e5109..e3e498f6f67b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_manifest_digest.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py index 6b77c55b7670..2f552fbc06ae 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_by_tag.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py index b57cf98d72a3..11165af292b9 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/import_image_from_public_registry.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py index 9e3fcdd91172..f8bd44a36d7b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/operation_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py index 3b86255a56ec..1c6e674240cf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_create_or_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py index b8359f6deb5e..0e209db10fa2 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py index 5c2eb2af5906..25c75b8d5701 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py index fab4cd1e744d..4f3319013cf7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/private_endpoint_connection_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py index 6fc115fe3924..1b4dc440570a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_available.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py index 8f5177883b47..3da0132ed431 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_check_name_not_available.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py index 7dc6ea43efc1..82fe539cba66 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py index 8670c9edcee7..4268ac13e661 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_abac.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py index 6d286a8a36bf..23cecac81b3b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_create_zone_redundant.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py index 325d8f30cdf9..843e1b60b4bd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py index b5970886280d..518867e0999d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_generate_credentials.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py index 0a35a50e9afd..b44f9f0a1adc 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py index 031583775c46..f3fa1544fad7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_get_private_link_resource.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py index 9b5031ca4e2c..71e73920f14b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py index c326f9a5a4d8..a017ea73478d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_by_resource_group.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py index 9ca3a72cce75..30b07307a6d6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_credentials.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py index 80acee57c322..38e757ffe461 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_private_link_resources.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py index ae443948a948..28b392b81db6 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_list_usages.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py index bab1d6abd810..f9dff068adda 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_regenerate_credential.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py index bd962f96d104..5c6a9258e82a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/registry_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py index 768947104bfd..980a30d0a3ee 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py index ae6976fc9b37..581618bfaf82 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_create_zone_redundant.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py index 3844ae437402..cf38319bdb14 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py index a9447ad5d6d9..93478c555eb8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py index daaaf32f0310..c47de56d3b1b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py index be150a9c9935..879a9f416501 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/replication_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py index 8189bce70075..f002c54af233 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_create.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py index 6360ee29c16a..0636e4e6a062 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py index 5ec9415f3c93..8bb0d867f6f7 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py index 4fe00738f030..ab0107b52617 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py index 5a7c6f74804f..6a945e9bed85 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/scope_map_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py index 196a26b3598f..6cd70f54826e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_create.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py index b43781bc0e22..a01ed6b28544 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py index 3fef741e1d88..dfe4ec2a822a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py index c300d4bb8082..7338bacc1e2c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py index 665f7766a542..079174c74e8a 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/token_update.py @@ -9,7 +9,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -26,7 +26,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py index c5f2a6ba5a7b..be0edb779adf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_create.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py index f6b2b6d5f96d..488fc128dd17 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_delete.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py index 56f4e6946c2b..b0f9d9e96814 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py index 6e867cd030ce..a02c58e5903c 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_get_callback_config.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py index 643ff2c718af..c90305db5b05 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py index 1fb9f84694cc..e1295cfb3c5f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_list_events.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py index 650c3cffa7e9..f296455b6449 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_ping.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py index e736e7ed321e..839cfff38ef0 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_samples/webhook_update.py @@ -8,7 +8,7 @@ from azure.identity import DefaultAzureCredential -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient """ # PREREQUISITES @@ -25,7 +25,7 @@ def main(): - client = ContainerRegistryClient( + client = ContainerRegistryManagementClient( credential=DefaultAzureCredential(), subscription_id="SUBSCRIPTION_ID", ) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py index 19fdce23b57b..7b6470b85865 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/conftest.py @@ -21,14 +21,26 @@ # For security, please avoid record sensitive identity information in recordings @pytest.fixture(scope="session", autouse=True) def add_sanitizers(test_proxy): - containerregistry_subscription_id = os.environ.get("AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000") - containerregistry_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") - containerregistry_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") - containerregistry_client_secret = os.environ.get("AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=containerregistry_subscription_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=containerregistry_tenant_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=containerregistry_client_id, value="00000000-0000-0000-0000-000000000000") - add_general_regex_sanitizer(regex=containerregistry_client_secret, value="00000000-0000-0000-0000-000000000000") + containerregistrymanagement_subscription_id = os.environ.get( + "AZURE_SUBSCRIPTION_ID", "00000000-0000-0000-0000-000000000000" + ) + containerregistrymanagement_tenant_id = os.environ.get("AZURE_TENANT_ID", "00000000-0000-0000-0000-000000000000") + containerregistrymanagement_client_id = os.environ.get("AZURE_CLIENT_ID", "00000000-0000-0000-0000-000000000000") + containerregistrymanagement_client_secret = os.environ.get( + "AZURE_CLIENT_SECRET", "00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=containerregistrymanagement_subscription_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=containerregistrymanagement_tenant_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=containerregistrymanagement_client_id, value="00000000-0000-0000-0000-000000000000" + ) + add_general_regex_sanitizer( + regex=containerregistrymanagement_client_secret, value="00000000-0000-0000-0000-000000000000" + ) add_header_regex_sanitizer(key="Set-Cookie", value="[set-cookie;]") add_header_regex_sanitizer(key="Cookie", value="cookie;") diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py index bbdd7c7401f6..c078987e14a8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryCacheRulesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementCacheRulesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py index f467a020d4a0..93566bd80377 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_cache_rules_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_cache_rules_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryCacheRulesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementCacheRulesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py similarity index 96% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py index 0c7872402a10..d75a9e86a4cf 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryConnectedRegistriesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementConnectedRegistriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py similarity index 96% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py index 442e3a7d0eae..c43a3530da16 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_connected_registries_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_connected_registries_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryConnectedRegistriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementConnectedRegistriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py index 07fd68155be4..e3712f45db70 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryCredentialSetsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementCredentialSetsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py index d57593fdde82..e7ed5cb0f022 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_credential_sets_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_credential_sets_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryCredentialSetsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementCredentialSetsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py index 911b9efd5023..daa88903373d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py similarity index 81% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py index bc3fd2772634..075e3a444d52 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py similarity index 93% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py index 7f3261f2f9a0..d5efc41f4127 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py similarity index 93% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py index 2701c3f25da6..db3e0b6bf5bd 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_private_endpoint_connections_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_private_endpoint_connections_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py similarity index 98% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py index 42eca8199a9f..b1571860e4ce 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryRegistriesOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementRegistriesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py similarity index 98% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py index f1457a5758f3..2402b9e71dc8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_registries_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_registries_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryRegistriesOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementRegistriesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py index 06a262c58e3a..e0d7d22c0a09 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryReplicationsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementReplicationsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py index a645737b1050..82065cca273e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_replications_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_replications_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryReplicationsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementReplicationsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py index 7cb76ae02400..fa128aa42aad 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryScopeMapsOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementScopeMapsOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py similarity index 94% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py index 5173e971bc97..db357b35b40d 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_scope_maps_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_scope_maps_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryScopeMapsOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementScopeMapsOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py index 87de2dd094bb..0ef9267529b8 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryTokensOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementTokensOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py index 27e1fad3e583..8256338d8f28 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_tokens_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_tokens_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryTokensOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementTokensOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py index 73e36a4c86d0..be5ab7585b20 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry import ContainerRegistryClient +from azure.mgmt.containerregistry import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy @@ -14,9 +14,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryWebhooksOperations(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementWebhooksOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py similarity index 95% rename from sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py rename to sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py index 66b4f1b40bf9..0240242a777f 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_webhooks_operations_async.py +++ b/sdk/containerregistry/azure-mgmt-containerregistry/generated_tests/test_container_registry_management_webhooks_operations_async.py @@ -6,7 +6,7 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest -from azure.mgmt.containerregistry.aio import ContainerRegistryClient +from azure.mgmt.containerregistry.aio import ContainerRegistryManagementClient from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer from devtools_testutils.aio import recorded_by_proxy_async @@ -15,9 +15,9 @@ @pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestContainerRegistryWebhooksOperationsAsync(AzureMgmtRecordedTestCase): +class TestContainerRegistryManagementWebhooksOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.client = self.create_mgmt_client(ContainerRegistryClient, is_async=True) + self.client = self.create_mgmt_client(ContainerRegistryManagementClient, is_async=True) @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml b/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml index c401729cef54..4dc37685c09e 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml +++ b/sdk/containerregistry/azure-mgmt-containerregistry/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/containerregistry/resource-manager/Microsoft.ContainerRegistry/Registry -commit: eb320d1d85f5b46c3cfe6cf60a1f0de4ef3b01d9 +commit: 9e837dc0b9ac5fa4a798367b6560336cb7ca28d3 repo: Azure/azure-rest-api-specs additionalDirectories: From 467b4cfe1463d8061e3688e6253a4bd3d8cf125a Mon Sep 17 00:00:00 2001 From: Yuchao Yan Date: Mon, 26 Jan 2026 10:26:46 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- .../azure-mgmt-containerregistry/CHANGELOG.md | 81 ------------------- 1 file changed, 81 deletions(-) diff --git a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md index e44ac6ce9e2d..f3d8007ec39b 100644 --- a/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md +++ b/sdk/containerregistry/azure-mgmt-containerregistry/CHANGELOG.md @@ -82,87 +82,6 @@ - Deleted or renamed model `PackageType` - Deleted or renamed model `StorageAccountProperties` -## 15.0.0 (2026-01-21) - -### Features Added - - - Model `ConnectedRegistry` added property `properties` - - Model `CredentialSetUpdateParameters` added property `properties` - - Model `OperationDefinition` added property `properties` - - Model `PrivateLinkResource` added property `system_data` - - Model `RegistryNameCheckRequest` added property `type` - - Model `RegistryUpdateParameters` added property `properties` - - Model `WebhookCreateParameters` added property `properties` - - Model `WebhookUpdateParameters` added property `properties` - - Added model `CacheRuleUpdateProperties` - - Added enum `ContainerRegistryResourceType` - - Added model `CredentialSetUpdateProperties` - - Added model `OperationPropertiesDefinition` - - Added model `RegistryPropertiesUpdateParameters` - - Added enum `RoleAssignmentMode` - - Added model `ScopeMapPropertiesUpdateParameters` - - Added model `TokenUpdateProperties` - - Added model `TrackedResource` - - Added model `WebhookPropertiesCreateParameters` - - Added model `WebhookPropertiesUpdateParameters` - -### Breaking Changes - - - Deleted or renamed client `ContainerRegistryManagementClient` - - Model `CacheRuleUpdateParameters` deleted or renamed its instance variable `credential_set_resource_id` - - Model `ConnectedRegistry` deleted or renamed its instance variable `provisioning_state` - - Model `ConnectedRegistry` deleted or renamed its instance variable `mode` - - Model `ConnectedRegistry` deleted or renamed its instance variable `version` - - Model `ConnectedRegistry` deleted or renamed its instance variable `connection_state` - - Model `ConnectedRegistry` deleted or renamed its instance variable `last_activity_time` - - Model `ConnectedRegistry` deleted or renamed its instance variable `activation` - - Model `ConnectedRegistry` deleted or renamed its instance variable `parent` - - Model `ConnectedRegistry` deleted or renamed its instance variable `client_token_ids` - - Model `ConnectedRegistry` deleted or renamed its instance variable `login_server` - - Model `ConnectedRegistry` deleted or renamed its instance variable `logging` - - Model `ConnectedRegistry` deleted or renamed its instance variable `status_details` - - Model `ConnectedRegistry` deleted or renamed its instance variable `notifications_list` - - Model `ConnectedRegistry` deleted or renamed its instance variable `garbage_collection` - - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `sync_properties` - - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `logging` - - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `client_token_ids` - - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `notifications_list` - - Model `ConnectedRegistryUpdateParameters` deleted or renamed its instance variable `garbage_collection` - - Model `CredentialSetUpdateParameters` deleted or renamed its instance variable `auth_credentials` - - Model `OperationDefinition` deleted or renamed its instance variable `service_specification` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `admin_user_enabled` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_set` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `policies` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `encryption` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `data_endpoint_enabled` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `public_network_access` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `network_rule_bypass_options` - - Model `RegistryUpdateParameters` deleted or renamed its instance variable `anonymous_pull_enabled` - - Model `Resource` deleted or renamed its instance variable `location` - - Model `Resource` deleted or renamed its instance variable `tags` - - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `description` - - Model `ScopeMapUpdateParameters` deleted or renamed its instance variable `actions` - - Model `TokenUpdateParameters` deleted or renamed its instance variable `scope_map_id` - - Model `TokenUpdateParameters` deleted or renamed its instance variable `status` - - Model `TokenUpdateParameters` deleted or renamed its instance variable `credentials` - - Model `WebhookCreateParameters` deleted or renamed its instance variable `service_uri` - - Model `WebhookCreateParameters` deleted or renamed its instance variable `custom_headers` - - Model `WebhookCreateParameters` deleted or renamed its instance variable `status` - - Model `WebhookCreateParameters` deleted or renamed its instance variable `scope` - - Model `WebhookCreateParameters` deleted or renamed its instance variable `actions` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `service_uri` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `custom_headers` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `status` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `scope` - - Model `WebhookUpdateParameters` deleted or renamed its instance variable `actions` - - Deleted or renamed model `ActiveDirectoryObject` - - Deleted or renamed model `ConnectedRegistryPropertiesActivation` - - Deleted or renamed model `ConnectedRegistryPropertiesAutoGenerated` - - Deleted or renamed model `ConnectedRegistryUpdateParametersProperties` - - Deleted or renamed model `LastModifiedByType` - - Deleted or renamed model `PackageType` - - Deleted or renamed model `StorageAccountProperties` - ## 14.1.0b4 (2025-12-05) ### Other Changes