From c0a324e73fbba6ca9cbe4e896b3eb5cfffcd9ee0 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 3 Jun 2026 08:12:18 +0000 Subject: [PATCH] Configurations: 'specification/hybridcompute/resource-manager/Microsoft.HybridCompute/HybridCompute/tspconfig.yaml', API Version: 2025-09-16-preview, SDK Release Type: beta, and CommitSHA: 'ecd420c9534d0dab69be38027c1723031504b081' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6388450 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../azure-mgmt-hybridcompute/CHANGELOG.md | 73 + .../azure-mgmt-hybridcompute/MANIFEST.in | 8 +- .../azure-mgmt-hybridcompute/README.md | 6 +- .../azure-mgmt-hybridcompute/_metadata.json | 15 +- .../apiview-properties.json | 299 + .../azure/__init__.py | 2 +- .../azure/mgmt/__init__.py | 2 +- .../azure/mgmt/hybridcompute/__init__.py | 4 +- ...ompute_management_client.py => _client.py} | 125 +- .../mgmt/hybridcompute/_configuration.py | 33 +- .../azure/mgmt/hybridcompute/_patch.py | 12 +- .../azure/mgmt/hybridcompute/_types.py | 11 + .../mgmt/hybridcompute/_utils/__init__.py | 2 +- .../mgmt/hybridcompute/_utils/model_base.py | 1737 +++ .../hybridcompute/_utils/serialization.py | 74 +- .../azure/mgmt/hybridcompute/_utils/utils.py | 2 +- .../azure/mgmt/hybridcompute/_version.py | 4 +- .../azure/mgmt/hybridcompute/aio/__init__.py | 4 +- ...ompute_management_client.py => _client.py} | 131 +- .../mgmt/hybridcompute/aio/_configuration.py | 33 +- .../azure/mgmt/hybridcompute/aio/_patch.py | 12 +- .../hybridcompute/aio/operations/__init__.py | 54 +- .../_extension_metadata_operations.py | 207 - .../_extension_metadata_v2_operations.py | 205 - .../_extension_publisher_operations.py | 134 - .../operations/_extension_type_operations.py | 136 - .../aio/operations/_gateways_operations.py | 713 - ...id_compute_management_client_operations.py | 447 - .../_license_profiles_operations.py | 737 -- .../aio/operations/_licenses_operations.py | 914 -- .../_machine_extensions_operations.py | 764 -- .../_machine_run_commands_operations.py | 552 - .../aio/operations/_machines_operations.py | 723 - .../operations/_network_profile_operations.py | 110 - ...ity_perimeter_configurations_operations.py | 341 - .../aio/operations/_operations.py | 9134 ++++++++++++- .../hybridcompute/aio/operations/_patch.py | 12 +- ...private_endpoint_connections_operations.py | 539 - .../_private_link_resources_operations.py | 203 - .../_private_link_scopes_operations.py | 789 -- .../aio/operations/_settings_operations.py | 448 - .../mgmt/hybridcompute/models/__init__.py | 110 +- ...e_management_client_enums.py => _enums.py} | 162 +- .../mgmt/hybridcompute/models/_models.py | 5638 ++++++++ .../mgmt/hybridcompute/models/_models_py3.py | 5968 --------- .../azure/mgmt/hybridcompute/models/_patch.py | 12 +- .../mgmt/hybridcompute/operations/__init__.py | 54 +- .../_extension_metadata_operations.py | 273 - .../_extension_metadata_v2_operations.py | 265 - .../_extension_publisher_operations.py | 159 - .../operations/_extension_type_operations.py | 165 - .../operations/_gateways_operations.py | 895 -- ...id_compute_management_client_operations.py | 520 - .../_license_profiles_operations.py | 907 -- .../operations/_licenses_operations.py | 1118 -- .../_machine_extensions_operations.py | 946 -- .../_machine_run_commands_operations.py | 687 - .../operations/_machines_operations.py | 918 -- .../operations/_network_profile_operations.py | 146 - ...ity_perimeter_configurations_operations.py | 449 - .../hybridcompute/operations/_operations.py | 10929 +++++++++++++++- .../mgmt/hybridcompute/operations/_patch.py | 12 +- ...private_endpoint_connections_operations.py | 692 - .../_private_link_resources_operations.py | 271 - .../_private_link_scopes_operations.py | 1036 -- .../operations/_settings_operations.py | 601 - .../{extension => }/extension_add.py | 7 +- .../extension_create_or_update.py | 7 +- .../{extension => }/extension_delete.py | 7 +- .../{extension => }/extension_get.py | 7 +- .../{extension => }/extension_list.py | 7 +- .../{extension => }/extension_metadata_get.py | 7 +- .../extension_metadata_list.py | 7 +- .../extension_metadata_v2_get.py | 5 +- .../extension_metadata_v2_list.py | 5 +- .../extension_publisher_list.py | 5 +- .../{extension => }/extension_type_list.py | 5 +- .../{extension => }/extension_update.py | 7 +- .../{extension => }/extensions_upgrade.py | 7 +- .../{gateway => }/gateway_create_or_update.py | 7 +- .../{gateway => }/gateway_delete.py | 7 +- .../{gateway => }/gateway_get.py | 7 +- .../gateway_list_by_resource_group.py | 7 +- .../gateway_list_by_subscription.py | 7 +- .../{gateway => }/gateway_update.py | 7 +- .../{license => }/license_create_or_update.py | 7 +- .../{license => }/license_delete.py | 7 +- .../{license => }/license_get.py | 7 +- .../license_list_by_resource_group.py | 7 +- .../license_list_by_subscription.py | 7 +- .../license_profile_create_or_update.py | 7 +- .../license_profile_delete.py | 7 +- .../license_profile_get.py | 7 +- .../license_profile_list.py | 7 +- .../license_profile_update.py | 7 +- .../{license => }/license_update.py | 7 +- .../{license => }/license_validate_license.py | 7 +- .../{machine => }/machine_assess_patches.py | 7 +- .../{machine => }/machine_install_patches.py | 7 +- .../machines_create_or_update.py | 57 + .../{machine => }/machines_delete.py | 7 +- .../{machine => }/machines_get.py | 7 +- ...hines_get_license_profile_instance_view.py | 7 +- .../machines_list_by_resource_group.py | 7 +- .../machines_list_by_subscription.py | 7 +- .../generated_samples/machines_update.py | 63 + .../generated_samples/network_profile_get.py | 7 +- ...rk_security_perimeter_configuration_get.py | 6 +- ...k_security_perimeter_configuration_list.py | 6 +- ...urity_perimeter_configuration_reconcile.py | 6 +- .../generated_samples/operations_list.py | 5 +- .../private_endpoint_connection_delete.py | 7 +- .../private_endpoint_connection_get.py | 7 +- .../private_endpoint_connection_list.py | 7 +- .../private_endpoint_connection_update.py | 9 +- ...te_link_scope_private_link_resource_get.py | 7 +- ...nk_scope_private_link_resource_list_get.py | 7 +- .../private_link_scopes_create.py | 7 +- .../private_link_scopes_delete.py | 7 +- .../private_link_scopes_get.py | 7 +- .../private_link_scopes_get_validation.py | 7 +- ..._link_scopes_get_validation_for_machine.py | 7 +- .../private_link_scopes_list.py | 7 +- ...vate_link_scopes_list_by_resource_group.py | 7 +- .../private_link_scopes_update.py | 7 +- .../private_link_scopes_update_tags_only.py | 43 + .../run_commands_create_or_update.py | 6 +- .../{run_command => }/run_commands_delete.py | 7 +- .../{run_command => }/run_commands_get.py | 7 +- .../{run_command => }/run_commands_list.py | 7 +- .../{settings => }/settings_get.py | 7 +- .../{settings => }/settings_patch.py | 6 +- .../{settings => }/settings_update.py | 6 +- .../generated_tests/conftest.py | 2 +- .../test_hybrid_compute_management.py | 4 +- .../test_hybrid_compute_management_async.py | 4 +- ...anagement_extension_metadata_operations.py | 4 +- ...ent_extension_metadata_operations_async.py | 4 +- ...gement_extension_metadata_v2_operations.py | 4 +- ..._extension_metadata_v2_operations_async.py | 4 +- ...nagement_extension_publisher_operations.py | 3 +- ...nt_extension_publisher_operations_async.py | 3 +- ...te_management_extension_type_operations.py | 3 +- ...agement_extension_type_operations_async.py | 3 +- ..._compute_management_gateways_operations.py | 47 +- ...te_management_gateways_operations_async.py | 47 +- ..._management_license_profiles_operations.py | 103 +- ...ement_license_profiles_operations_async.py | 103 +- ..._compute_management_licenses_operations.py | 142 +- ...te_management_licenses_operations_async.py | 146 +- ...anagement_machine_extensions_operations.py | 49 +- ...ent_machine_extensions_operations_async.py | 49 +- ...agement_machine_run_commands_operations.py | 100 +- ...t_machine_run_commands_operations_async.py | 100 +- ..._compute_management_machines_operations.py | 406 +- ...te_management_machines_operations_async.py | 406 +- ...e_management_network_profile_operations.py | 3 +- ...gement_network_profile_operations_async.py | 3 +- ...ity_perimeter_configurations_operations.py | 5 +- ...rimeter_configurations_operations_async.py | 5 +- ...st_hybrid_compute_management_operations.py | 6 +- ...rid_compute_management_operations_async.py | 6 +- ...private_endpoint_connections_operations.py | 6 +- ...e_endpoint_connections_operations_async.py | 6 +- ...ement_private_link_resources_operations.py | 18 +- ...private_link_resources_operations_async.py | 18 +- ...nagement_private_link_scopes_operations.py | 74 +- ...nt_private_link_scopes_operations_async.py | 78 +- ..._compute_management_settings_operations.py | 11 +- ...te_management_settings_operations_async.py | 11 +- .../azure-mgmt-hybridcompute/pyproject.toml | 81 + .../sdk_packaging.toml | 8 - .../azure-mgmt-hybridcompute/setup.py | 82 - .../tsp-location.yaml | 4 + 174 files changed, 30090 insertions(+), 25352 deletions(-) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/apiview-properties.json rename sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/{_hybrid_compute_management_client.py => _client.py} (81%) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_types.py create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/model_base.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/{_hybrid_compute_management_client.py => _client.py} (82%) delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_v2_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_publisher_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_type_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_gateways_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_run_commands_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_settings_operations.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/{_hybrid_compute_management_client_enums.py => _enums.py} (74%) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_v2_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_publisher_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_type_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_gateways_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_run_commands_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_security_perimeter_configurations_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_settings_operations.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_add.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_create_or_update.py (84%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_delete.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_get.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_list.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_metadata_get.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_metadata_list.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_metadata_v2_get.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_metadata_v2_list.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_publisher_list.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_type_list.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extension_update.py (85%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{extension => }/extensions_upgrade.py (83%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_create_or_update.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_delete.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_get.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_list_by_resource_group.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_list_by_subscription.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{gateway => }/gateway_update.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_create_or_update.py (84%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_delete.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_get.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_list_by_resource_group.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_list_by_subscription.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license_profile => }/license_profile_create_or_update.py (85%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license_profile => }/license_profile_delete.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license_profile => }/license_profile_get.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license_profile => }/license_profile_list.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license_profile => }/license_profile_update.py (84%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_update.py (84%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{license => }/license_validate_license.py (84%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machine_assess_patches.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machine_install_patches.py (84%) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_create_or_update.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machines_delete.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machines_get.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machines_get_license_profile_instance_view.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machines_list_by_resource_group.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{machine => }/machines_list_by_subscription.py (79%) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_update.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{network_security_perimeter_configuration => }/network_security_perimeter_configuration_get.py (82%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{network_security_perimeter_configuration => }/network_security_perimeter_configuration_list.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{network_security_perimeter_configuration => }/network_security_perimeter_configuration_reconcile.py (82%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_endpoint => }/private_endpoint_connection_delete.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_endpoint => }/private_endpoint_connection_get.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_endpoint => }/private_endpoint_connection_list.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_endpoint => }/private_endpoint_connection_update.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scope_private_link_resource_get.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scope_private_link_resource_list_get.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_create.py (80%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_delete.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_get.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_get_validation.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_get_validation_for_machine.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_list.py (78%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_list_by_resource_group.py (79%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{private_link_scope => }/private_link_scopes_update.py (80%) create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update_tags_only.py rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{run_command => }/run_commands_create_or_update.py (88%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{run_command => }/run_commands_delete.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{run_command => }/run_commands_get.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{run_command => }/run_commands_list.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{settings => }/settings_get.py (81%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{settings => }/settings_patch.py (86%) rename sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/{settings => }/settings_update.py (86%) delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/sdk_packaging.toml delete mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py create mode 100644 sdk/hybridcompute/azure-mgmt-hybridcompute/tsp-location.yaml diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md b/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md index 834b0fc11dab..d9544b6e75ac 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/CHANGELOG.md @@ -1,5 +1,78 @@ # Release History +## 9.1.0b3 (2026-06-03) + +### Features Added + + - Client `HybridComputeManagementClient` added parameter `cloud_setting` in method `__init__` + - Client `HybridComputeManagementClient` added method `send_request` + - Model `ExtensionValue` added property `properties` + - Model `ExtensionValueV2` added property `properties` + - Model `HybridComputePrivateLinkScopeProperties` added property `service_extensions` + - Model `LicenseProfileMachineInstanceView` added property `software_assurance` + - Model `LicenseProfileMachineInstanceView` added property `product_profile` + - Model `NetworkSecurityPerimeterConfiguration` added property `system_data` + - Added model `EsuProfileUpdateProperties` + - Added model `LicenseProfileArmProductProfileProperties` + - Added model `LicenseProfileMachineInstanceViewSoftwareAssurance` + - Added model `LicenseProfilePropertiesSoftwareAssurance` + - Added model `LicenseProfileUpdatePropertiesSoftwareAssurance` + - Added model `LicenseUpdatePropertiesLicenseDetails` + - Added model `PatchSettings` + - Added model `ProductProfileUpdateProperties` + - Added enum `ResourceIdentityType` + - Added model `ServiceExtension` + - Added enum `ServiceExtensionPublicNetworkAccess` + - Added model `SettingsGatewayProperties` + - Model `MachinesOperations` added method `create_or_update` + +### Breaking Changes + + - Model `ExtensionValue` deleted or renamed its instance variable `version` + - Model `ExtensionValue` deleted or renamed its instance variable `extension_type` + - Model `ExtensionValue` deleted or renamed its instance variable `publisher` + - Model `ExtensionValueV2` deleted or renamed its instance variable `version` + - Model `ExtensionValueV2` deleted or renamed its instance variable `extension_type` + - Model `ExtensionValueV2` deleted or renamed its instance variable `publisher` + - Model `ExtensionValueV2` deleted or renamed its instance variable `extension_uris` + - Model `ExtensionValueV2` deleted or renamed its instance variable `extension_signature_uri` + - Model `ExtensionValueV2` deleted or renamed its instance variable `operating_system` + - Model `ExtensionValueV2` deleted or renamed its instance variable `architecture` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `subscription_status` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `product_type` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `enrollment_date` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `billing_start_date` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `disenrollment_date` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `billing_end_date` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `error` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `product_features` + - Model `LicenseProfileMachineInstanceView` deleted or renamed its instance variable `software_assurance_customer` + - Model `OSProfileLinuxConfiguration` deleted or renamed its instance variable `assessment_mode` + - Model `OSProfileLinuxConfiguration` deleted or renamed its instance variable `patch_mode` + - Model `OSProfileLinuxConfiguration` deleted or renamed its instance variable `enable_hotpatching` + - Model `OSProfileLinuxConfiguration` deleted or renamed its instance variable `status` + - Model `OSProfileWindowsConfiguration` deleted or renamed its instance variable `assessment_mode` + - Model `OSProfileWindowsConfiguration` deleted or renamed its instance variable `patch_mode` + - Model `OSProfileWindowsConfiguration` deleted or renamed its instance variable `enable_hotpatching` + - Model `OSProfileWindowsConfiguration` deleted or renamed its instance variable `status` + - Deleted or renamed model `AgentVersion` + - Deleted or renamed model `AgentVersionsList` + - Deleted or renamed model `ExtensionValueListResultV2` + - Deleted or renamed model `HybridIdentityMetadata` + - Deleted or renamed model `HybridIdentityMetadataList` + - Deleted or renamed model `KeyDetails` + - Deleted or renamed model `KeyProperties` + - Deleted or renamed model `MachineRunCommandUpdate` + - Deleted or renamed model `NetworkConfiguration` + - Deleted or renamed model `PrivateLinkScopesResource` + - Deleted or renamed model `ProxyResourceAutoGenerated` + - Deleted or renamed model `ResourceAutoGenerated` + - Method `MachineExtensionsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `MachineRunCommandsOperations.list` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `MachinesOperations.get` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Method `MachinesOperations.list_by_resource_group` changed its parameter `expand` from `positional_or_keyword` to `keyword_only` + - Deleted or renamed model `HybridComputeManagementClientOperationsMixin` + ## 9.1.0b2 (2025-06-16) ### Features Added diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/MANIFEST.in b/sdk/hybridcompute/azure-mgmt-hybridcompute/MANIFEST.in index d74fe1fb377d..ada8425a0729 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/MANIFEST.in +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/MANIFEST.in @@ -1,7 +1,7 @@ -recursive-include tests *.py *.json -recursive-include samples *.py *.md include *.md -include azure/__init__.py -include azure/mgmt/__init__.py include LICENSE include azure/mgmt/hybridcompute/py.typed +recursive-include tests *.py +recursive-include samples *.py *.md +include azure/__init__.py +include azure/mgmt/__init__.py diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md b/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md index d0c009fd50fe..16a3245e72f4 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Hybrid Compute Management Client Library. -This package has been tested with Python 3.9+. +This package has been tested with Python 3.10+. For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). ## _Disclaimer_ @@ -12,7 +12,7 @@ _Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For ### Prerequisites -- Python 3.9+ is required to use this package. +- Python 3.10+ is required to use this package. - [Azure subscription](https://azure.microsoft.com/free/) ### Install the package @@ -24,7 +24,7 @@ pip install azure-identity ### Authentication -By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configuration of the following environment variables. +By default, [Microsoft Entra](https://learn.microsoft.com/entra/fundamentals/what-is-entra) token authentication depends on correct configuration of the following environment variables. - `AZURE_CLIENT_ID` for Azure client ID. - `AZURE_TENANT_ID` for Azure tenant ID. diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/_metadata.json b/sdk/hybridcompute/azure-mgmt-hybridcompute/_metadata.json index f37fc3de261f..ebad15250a4b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/_metadata.json +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/_metadata.json @@ -1,11 +1,10 @@ { - "commit": "e411473e135e0f0f3c763565ee401be34ccd9f99", + "apiVersion": "2025-09-16-preview", + "apiVersions": { + "Microsoft.HybridCompute": "2025-09-16-preview" + }, + "commit": "ecd420c9534d0dab69be38027c1723031504b081", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.35.0", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/hybridcompute/resource-manager/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.35.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/hybridcompute/resource-manager/readme.md" + "typespec_src": "specification/hybridcompute/resource-manager/Microsoft.HybridCompute/HybridCompute", + "emitterVersion": "0.62.1" } \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/apiview-properties.json b/sdk/hybridcompute/azure-mgmt-hybridcompute/apiview-properties.json new file mode 100644 index 000000000000..a06e9aeada61 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/apiview-properties.json @@ -0,0 +1,299 @@ +{ + "CrossLanguagePackageId": "Microsoft.HybridCompute", + "CrossLanguageDefinitionId": { + "azure.mgmt.hybridcompute.models.AccessRule": "Microsoft.HybridCompute.AccessRule", + "azure.mgmt.hybridcompute.models.AccessRuleProperties": "Microsoft.HybridCompute.AccessRuleProperties", + "azure.mgmt.hybridcompute.models.AgentConfiguration": "Microsoft.HybridCompute.AgentConfiguration", + "azure.mgmt.hybridcompute.models.AgentUpgrade": "Microsoft.HybridCompute.AgentUpgrade", + "azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification": "Microsoft.HybridCompute.AvailablePatchCountByClassification", + "azure.mgmt.hybridcompute.models.CloudMetadata": "Microsoft.HybridCompute.CloudMetadata", + "azure.mgmt.hybridcompute.models.ConfigurationExtension": "Microsoft.HybridCompute.ConfigurationExtension", + "azure.mgmt.hybridcompute.models.ConnectionDetail": "Microsoft.HybridCompute.ConnectionDetail", + "azure.mgmt.hybridcompute.models.Disk": "Microsoft.HybridCompute.Disk", + "azure.mgmt.hybridcompute.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.hybridcompute.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.hybridcompute.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.hybridcompute.models.EsuKey": "Microsoft.HybridCompute.EsuKey", + "azure.mgmt.hybridcompute.models.EsuProfileUpdateProperties": "Microsoft.HybridCompute.EsuProfileUpdateProperties", + "azure.mgmt.hybridcompute.models.ExtensionPublisher": "Microsoft.HybridCompute.ExtensionPublisher", + "azure.mgmt.hybridcompute.models.ExtensionsResourceStatus": "Microsoft.HybridCompute.ExtensionsResourceStatus", + "azure.mgmt.hybridcompute.models.ExtensionTargetProperties": "Microsoft.HybridCompute.ExtensionTargetProperties", + "azure.mgmt.hybridcompute.models.ExtensionType": "Microsoft.HybridCompute.ExtensionType", + "azure.mgmt.hybridcompute.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.hybridcompute.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.hybridcompute.models.ExtensionValue": "Microsoft.HybridCompute.ExtensionValue", + "azure.mgmt.hybridcompute.models.ExtensionValueProperties": "Microsoft.HybridCompute.ExtensionValueProperties", + "azure.mgmt.hybridcompute.models.ExtensionValueV2": "Microsoft.HybridCompute.ExtensionValueV2", + "azure.mgmt.hybridcompute.models.ExtensionValueV2Properties": "Microsoft.HybridCompute.ExtensionValueV2Properties", + "azure.mgmt.hybridcompute.models.FirmwareProfile": "Microsoft.HybridCompute.FirmwareProfile", + "azure.mgmt.hybridcompute.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.hybridcompute.models.Gateway": "Microsoft.HybridCompute.Gateway", + "azure.mgmt.hybridcompute.models.GatewayProperties": "Microsoft.HybridCompute.GatewayProperties", + "azure.mgmt.hybridcompute.models.ResourceUpdate": "Microsoft.HybridCompute.ResourceUpdate", + "azure.mgmt.hybridcompute.models.GatewayUpdate": "Microsoft.HybridCompute.GatewayUpdate", + "azure.mgmt.hybridcompute.models.GatewayUpdateProperties": "Microsoft.HybridCompute.GatewayUpdateProperties", + "azure.mgmt.hybridcompute.models.HardwareProfile": "Microsoft.HybridCompute.HardwareProfile", + "azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope": "Microsoft.HybridCompute.HybridComputePrivateLinkScope", + "azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties": "Microsoft.HybridCompute.HybridComputePrivateLinkScopeProperties", + "azure.mgmt.hybridcompute.models.Identity": "Azure.ResourceManager.CommonTypes.Identity", + "azure.mgmt.hybridcompute.models.IpAddress": "Microsoft.HybridCompute.IpAddress", + "azure.mgmt.hybridcompute.models.License": "Microsoft.HybridCompute.License", + "azure.mgmt.hybridcompute.models.LicenseDetails": "Microsoft.HybridCompute.LicenseDetails", + "azure.mgmt.hybridcompute.models.LicenseProfile": "Microsoft.HybridCompute.LicenseProfile", + "azure.mgmt.hybridcompute.models.LicenseProfileStorageModelEsuProperties": "Microsoft.HybridCompute.LicenseProfileStorageModelEsuProperties", + "azure.mgmt.hybridcompute.models.LicenseProfileArmEsuPropertiesWithoutAssignedLicense": "Microsoft.HybridCompute.LicenseProfileArmEsuPropertiesWithoutAssignedLicense", + "azure.mgmt.hybridcompute.models.LicenseProfileArmEsuProperties": "Microsoft.HybridCompute.LicenseProfileArmEsuProperties", + "azure.mgmt.hybridcompute.models.LicenseProfileArmProductProfileProperties": "Microsoft.HybridCompute.LicenseProfileArmProductProfileProperties", + "azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView": "Microsoft.HybridCompute.LicenseProfileMachineInstanceView", + "azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties": "Microsoft.HybridCompute.LicenseProfileMachineInstanceViewEsuProperties", + "azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewSoftwareAssurance": "Microsoft.HybridCompute.LicenseProfileMachineInstanceViewSoftwareAssurance", + "azure.mgmt.hybridcompute.models.LicenseProfileProperties": "Microsoft.HybridCompute.LicenseProfileProperties", + "azure.mgmt.hybridcompute.models.LicenseProfilePropertiesSoftwareAssurance": "Microsoft.HybridCompute.LicenseProfilePropertiesSoftwareAssurance", + "azure.mgmt.hybridcompute.models.LicenseProfileUpdate": "Microsoft.HybridCompute.LicenseProfileUpdate", + "azure.mgmt.hybridcompute.models.LicenseProfileUpdateProperties": "Microsoft.HybridCompute.LicenseProfileUpdateProperties", + "azure.mgmt.hybridcompute.models.LicenseProfileUpdatePropertiesSoftwareAssurance": "Microsoft.HybridCompute.LicenseProfileUpdatePropertiesSoftwareAssurance", + "azure.mgmt.hybridcompute.models.LicenseProperties": "Microsoft.HybridCompute.LicenseProperties", + "azure.mgmt.hybridcompute.models.LicenseUpdate": "Microsoft.HybridCompute.LicenseUpdate", + "azure.mgmt.hybridcompute.models.LicenseUpdateProperties": "Microsoft.HybridCompute.LicenseUpdateProperties", + "azure.mgmt.hybridcompute.models.LicenseUpdatePropertiesLicenseDetails": "Microsoft.HybridCompute.LicenseUpdatePropertiesLicenseDetails", + "azure.mgmt.hybridcompute.models.LinuxParameters": "Microsoft.HybridCompute.LinuxParameters", + "azure.mgmt.hybridcompute.models.LocationData": "Azure.ResourceManager.CommonTypes.LocationData", + "azure.mgmt.hybridcompute.models.Machine": "Microsoft.HybridCompute.Machine", + "azure.mgmt.hybridcompute.models.MachineAssessPatchesResult": "Microsoft.HybridCompute.MachineAssessPatchesResult", + "azure.mgmt.hybridcompute.models.MachineExtension": "Microsoft.HybridCompute.MachineExtension", + "azure.mgmt.hybridcompute.models.MachineExtensionInstanceView": "Microsoft.HybridCompute.MachineExtensionInstanceView", + "azure.mgmt.hybridcompute.models.MachineExtensionInstanceViewStatus": "Microsoft.HybridCompute.MachineExtensionInstanceViewStatus", + "azure.mgmt.hybridcompute.models.MachineExtensionProperties": "Microsoft.HybridCompute.MachineExtensionProperties", + "azure.mgmt.hybridcompute.models.MachineExtensionUpdate": "Microsoft.HybridCompute.MachineExtensionUpdate", + "azure.mgmt.hybridcompute.models.MachineExtensionUpdateProperties": "Microsoft.HybridCompute.MachineExtensionUpdateProperties", + "azure.mgmt.hybridcompute.models.MachineExtensionUpgrade": "Microsoft.HybridCompute.MachineExtensionUpgrade", + "azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters": "Microsoft.HybridCompute.MachineInstallPatchesParameters", + "azure.mgmt.hybridcompute.models.MachineInstallPatchesResult": "Microsoft.HybridCompute.MachineInstallPatchesResult", + "azure.mgmt.hybridcompute.models.MachineProperties": "Microsoft.HybridCompute.MachineProperties", + "azure.mgmt.hybridcompute.models.MachineRunCommand": "Microsoft.HybridCompute.MachineRunCommand", + "azure.mgmt.hybridcompute.models.MachineRunCommandInstanceView": "Microsoft.HybridCompute.MachineRunCommandInstanceView", + "azure.mgmt.hybridcompute.models.MachineRunCommandProperties": "Microsoft.HybridCompute.MachineRunCommandProperties", + "azure.mgmt.hybridcompute.models.MachineRunCommandScriptSource": "Microsoft.HybridCompute.MachineRunCommandScriptSource", + "azure.mgmt.hybridcompute.models.MachineUpdate": "Microsoft.HybridCompute.MachineUpdate", + "azure.mgmt.hybridcompute.models.MachineUpdateProperties": "Microsoft.HybridCompute.MachineUpdateProperties", + "azure.mgmt.hybridcompute.models.NetworkInterface": "Microsoft.HybridCompute.NetworkInterface", + "azure.mgmt.hybridcompute.models.NetworkProfile": "Microsoft.HybridCompute.NetworkProfile", + "azure.mgmt.hybridcompute.models.NetworkSecurityPerimeter": "Microsoft.HybridCompute.NetworkSecurityPerimeter", + "azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfiguration", + "azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationProperties": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurationProperties", + "azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationReconcileResult": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurationReconcileResult", + "azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterProfile": "Microsoft.HybridCompute.NetworkSecurityPerimeterProfile", + "azure.mgmt.hybridcompute.models.OperationValue": "Microsoft.HybridCompute.OperationValue", + "azure.mgmt.hybridcompute.models.OperationValueDisplay": "Microsoft.HybridCompute.OperationValueDisplay", + "azure.mgmt.hybridcompute.models.OSProfile": "Microsoft.HybridCompute.OSProfile", + "azure.mgmt.hybridcompute.models.OSProfileLinuxConfiguration": "Microsoft.HybridCompute.OSProfileLinuxConfiguration", + "azure.mgmt.hybridcompute.models.OSProfileWindowsConfiguration": "Microsoft.HybridCompute.OSProfileWindowsConfiguration", + "azure.mgmt.hybridcompute.models.PatchSettings": "Microsoft.HybridCompute.PatchSettings", + "azure.mgmt.hybridcompute.models.PatchSettingsStatus": "Microsoft.HybridCompute.PatchSettingsStatus", + "azure.mgmt.hybridcompute.models.PrivateEndpointConnection": "Microsoft.HybridCompute.PrivateEndpointConnection", + "azure.mgmt.hybridcompute.models.PrivateEndpointConnectionDataModel": "Microsoft.HybridCompute.PrivateEndpointConnectionDataModel", + "azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties": "Microsoft.HybridCompute.PrivateEndpointConnectionProperties", + "azure.mgmt.hybridcompute.models.PrivateEndpointProperty": "Microsoft.HybridCompute.PrivateEndpointProperty", + "azure.mgmt.hybridcompute.models.PrivateLinkResource": "Microsoft.HybridCompute.PrivateLinkResource", + "azure.mgmt.hybridcompute.models.PrivateLinkResourceProperties": "Microsoft.HybridCompute.PrivateLinkResourceProperties", + "azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails": "Microsoft.HybridCompute.PrivateLinkScopeValidationDetails", + "azure.mgmt.hybridcompute.models.PrivateLinkServiceConnectionStateProperty": "Microsoft.HybridCompute.PrivateLinkServiceConnectionStateProperty", + "azure.mgmt.hybridcompute.models.Processor": "Microsoft.HybridCompute.Processor", + "azure.mgmt.hybridcompute.models.ProductFeature": "Microsoft.HybridCompute.ProductFeature", + "azure.mgmt.hybridcompute.models.ProductFeatureUpdate": "Microsoft.HybridCompute.ProductFeatureUpdate", + "azure.mgmt.hybridcompute.models.ProductProfileUpdateProperties": "Microsoft.HybridCompute.ProductProfileUpdateProperties", + "azure.mgmt.hybridcompute.models.ProvisioningIssue": "Microsoft.HybridCompute.ProvisioningIssue", + "azure.mgmt.hybridcompute.models.ProvisioningIssueProperties": "Microsoft.HybridCompute.ProvisioningIssueProperties", + "azure.mgmt.hybridcompute.models.ResourceAssociation": "Microsoft.HybridCompute.ResourceAssociation", + "azure.mgmt.hybridcompute.models.RunCommandInputParameter": "Microsoft.HybridCompute.RunCommandInputParameter", + "azure.mgmt.hybridcompute.models.RunCommandManagedIdentity": "Microsoft.HybridCompute.RunCommandManagedIdentity", + "azure.mgmt.hybridcompute.models.ServiceExtension": "Microsoft.HybridCompute.ServiceExtension", + "azure.mgmt.hybridcompute.models.ServiceStatus": "Microsoft.HybridCompute.ServiceStatus", + "azure.mgmt.hybridcompute.models.ServiceStatuses": "Microsoft.HybridCompute.ServiceStatuses", + "azure.mgmt.hybridcompute.models.Settings": "Microsoft.HybridCompute.Settings", + "azure.mgmt.hybridcompute.models.SettingsGatewayProperties": "Microsoft.HybridCompute.SettingsGatewayProperties", + "azure.mgmt.hybridcompute.models.SettingsProperties": "Microsoft.HybridCompute.SettingsProperties", + "azure.mgmt.hybridcompute.models.SetupExtensionRequest": "Microsoft.HybridCompute.SetupExtensionRequest", + "azure.mgmt.hybridcompute.models.StorageProfile": "Microsoft.HybridCompute.StorageProfile", + "azure.mgmt.hybridcompute.models.Subnet": "Microsoft.HybridCompute.Subnet", + "azure.mgmt.hybridcompute.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.hybridcompute.models.TagsResource": "Microsoft.HybridCompute.TagsResource", + "azure.mgmt.hybridcompute.models.VolumeLicenseDetails": "Microsoft.HybridCompute.VolumeLicenseDetails", + "azure.mgmt.hybridcompute.models.WindowsParameters": "Microsoft.HybridCompute.WindowsParameters", + "azure.mgmt.hybridcompute.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.hybridcompute.models.ProvisioningState": "Microsoft.HybridCompute.ProvisioningState", + "azure.mgmt.hybridcompute.models.LicenseType": "Microsoft.HybridCompute.LicenseType", + "azure.mgmt.hybridcompute.models.LicenseState": "Microsoft.HybridCompute.LicenseState", + "azure.mgmt.hybridcompute.models.LicenseTarget": "Microsoft.HybridCompute.LicenseTarget", + "azure.mgmt.hybridcompute.models.LicenseEdition": "Microsoft.HybridCompute.LicenseEdition", + "azure.mgmt.hybridcompute.models.LicenseCoreType": "Microsoft.HybridCompute.LicenseCoreType", + "azure.mgmt.hybridcompute.models.ProgramYear": "Microsoft.HybridCompute.ProgramYear", + "azure.mgmt.hybridcompute.models.AgentConfigurationMode": "Microsoft.HybridCompute.AgentConfigurationMode", + "azure.mgmt.hybridcompute.models.LastAttemptStatusEnum": "Microsoft.HybridCompute.LastAttemptStatusEnum", + "azure.mgmt.hybridcompute.models.AssessmentModeTypes": "Microsoft.HybridCompute.AssessmentModeTypes", + "azure.mgmt.hybridcompute.models.PatchModeTypes": "Microsoft.HybridCompute.PatchModeTypes", + "azure.mgmt.hybridcompute.models.HotpatchEnablementStatus": "Microsoft.HybridCompute.HotpatchEnablementStatus", + "azure.mgmt.hybridcompute.models.LicenseStatus": "Microsoft.HybridCompute.LicenseStatus", + "azure.mgmt.hybridcompute.models.EsuServerType": "Microsoft.HybridCompute.EsuServerType", + "azure.mgmt.hybridcompute.models.EsuEligibility": "Microsoft.HybridCompute.EsuEligibility", + "azure.mgmt.hybridcompute.models.EsuKeyState": "Microsoft.HybridCompute.EsuKeyState", + "azure.mgmt.hybridcompute.models.LicenseAssignmentState": "Microsoft.HybridCompute.LicenseAssignmentState", + "azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus": "Microsoft.HybridCompute.LicenseProfileSubscriptionStatus", + "azure.mgmt.hybridcompute.models.LicenseProfileProductType": "Microsoft.HybridCompute.LicenseProfileProductType", + "azure.mgmt.hybridcompute.models.StatusTypes": "Microsoft.HybridCompute.StatusTypes", + "azure.mgmt.hybridcompute.models.IdentityKeyStore": "Microsoft.HybridCompute.IdentityKeyStore", + "azure.mgmt.hybridcompute.models.StatusLevelTypes": "Microsoft.HybridCompute.StatusLevelTypes", + "azure.mgmt.hybridcompute.models.ResourceIdentityType": "Azure.ResourceManager.CommonTypes.ResourceIdentityType", + "azure.mgmt.hybridcompute.models.ArcKindEnum": "Microsoft.HybridCompute.ArcKindEnum", + "azure.mgmt.hybridcompute.models.InstanceViewTypes": "Microsoft.HybridCompute.InstanceViewTypes", + "azure.mgmt.hybridcompute.models.PatchOperationStatus": "Microsoft.HybridCompute.PatchOperationStatus", + "azure.mgmt.hybridcompute.models.PatchOperationStartedBy": "Microsoft.HybridCompute.PatchOperationStartedBy", + "azure.mgmt.hybridcompute.models.PatchServiceUsed": "Microsoft.HybridCompute.PatchServiceUsed", + "azure.mgmt.hybridcompute.models.OsType": "Microsoft.HybridCompute.OsType", + "azure.mgmt.hybridcompute.models.VMGuestPatchRebootStatus": "Microsoft.HybridCompute.VMGuestPatchRebootStatus", + "azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting": "Microsoft.HybridCompute.VMGuestPatchRebootSetting", + "azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows": "Microsoft.HybridCompute.VMGuestPatchClassification_Windows", + "azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux": "Microsoft.HybridCompute.VMGuestPatchClassification_Linux", + "azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate": "Microsoft.HybridCompute.LicenseProfileSubscriptionStatusUpdate", + "azure.mgmt.hybridcompute.models.ExecutionState": "Microsoft.HybridCompute.ExecutionState", + "azure.mgmt.hybridcompute.models.ExtensionsStatusLevelTypes": "Microsoft.HybridCompute.ExtensionsStatusLevelTypes", + "azure.mgmt.hybridcompute.models.GatewayType": "Microsoft.HybridCompute.GatewayType", + "azure.mgmt.hybridcompute.models.ProvisioningIssueType": "Microsoft.HybridCompute.ProvisioningIssueType", + "azure.mgmt.hybridcompute.models.ProvisioningIssueSeverity": "Microsoft.HybridCompute.ProvisioningIssueSeverity", + "azure.mgmt.hybridcompute.models.AccessRuleDirection": "Microsoft.HybridCompute.AccessRuleDirection", + "azure.mgmt.hybridcompute.models.AccessMode": "Microsoft.HybridCompute.AccessMode", + "azure.mgmt.hybridcompute.models.PublicNetworkAccessType": "CustomPublicNetworkAccessType", + "azure.mgmt.hybridcompute.models.ServiceExtensionPublicNetworkAccess": "Microsoft.HybridCompute.ServiceExtensionPublicNetworkAccess", + "azure.mgmt.hybridcompute.operations.Operations.list": "Microsoft.HybridCompute.Operations.list", + "azure.mgmt.hybridcompute.aio.operations.Operations.list": "Microsoft.HybridCompute.Operations.list", + "azure.mgmt.hybridcompute.operations.LicensesOperations.get": "Microsoft.HybridCompute.Licenses.get", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.get": "Microsoft.HybridCompute.Licenses.get", + "azure.mgmt.hybridcompute.operations.LicensesOperations.begin_create_or_update": "Microsoft.HybridCompute.Licenses.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.begin_create_or_update": "Microsoft.HybridCompute.Licenses.createOrUpdate", + "azure.mgmt.hybridcompute.operations.LicensesOperations.begin_update": "Microsoft.HybridCompute.Licenses.update", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.begin_update": "Microsoft.HybridCompute.Licenses.update", + "azure.mgmt.hybridcompute.operations.LicensesOperations.begin_delete": "Microsoft.HybridCompute.Licenses.delete", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.begin_delete": "Microsoft.HybridCompute.Licenses.delete", + "azure.mgmt.hybridcompute.operations.LicensesOperations.list_by_resource_group": "Microsoft.HybridCompute.Licenses.listByResourceGroup", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.list_by_resource_group": "Microsoft.HybridCompute.Licenses.listByResourceGroup", + "azure.mgmt.hybridcompute.operations.LicensesOperations.list_by_subscription": "Microsoft.HybridCompute.Licenses.listBySubscription", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.list_by_subscription": "Microsoft.HybridCompute.Licenses.listBySubscription", + "azure.mgmt.hybridcompute.operations.LicensesOperations.begin_validate_license": "Microsoft.HybridCompute.LicensesOperationGroup.validateLicense", + "azure.mgmt.hybridcompute.aio.operations.LicensesOperations.begin_validate_license": "Microsoft.HybridCompute.LicensesOperationGroup.validateLicense", + "azure.mgmt.hybridcompute.operations.MachinesOperations.get": "Microsoft.HybridCompute.Machines.get", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.get": "Microsoft.HybridCompute.Machines.get", + "azure.mgmt.hybridcompute.operations.MachinesOperations.create_or_update": "Microsoft.HybridCompute.Machines.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.create_or_update": "Microsoft.HybridCompute.Machines.createOrUpdate", + "azure.mgmt.hybridcompute.operations.MachinesOperations.update": "Microsoft.HybridCompute.Machines.update", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.update": "Microsoft.HybridCompute.Machines.update", + "azure.mgmt.hybridcompute.operations.MachinesOperations.begin_delete": "Microsoft.HybridCompute.Machines.delete", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.begin_delete": "Microsoft.HybridCompute.Machines.delete", + "azure.mgmt.hybridcompute.operations.MachinesOperations.list_by_resource_group": "Microsoft.HybridCompute.Machines.listByResourceGroup", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.list_by_resource_group": "Microsoft.HybridCompute.Machines.listByResourceGroup", + "azure.mgmt.hybridcompute.operations.MachinesOperations.list_by_subscription": "Microsoft.HybridCompute.Machines.listBySubscription", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.list_by_subscription": "Microsoft.HybridCompute.Machines.listBySubscription", + "azure.mgmt.hybridcompute.operations.MachinesOperations.begin_assess_patches": "Microsoft.HybridCompute.Machines.assessPatches", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.begin_assess_patches": "Microsoft.HybridCompute.Machines.assessPatches", + "azure.mgmt.hybridcompute.operations.MachinesOperations.begin_install_patches": "Microsoft.HybridCompute.Machines.installPatches", + "azure.mgmt.hybridcompute.aio.operations.MachinesOperations.begin_install_patches": "Microsoft.HybridCompute.Machines.installPatches", + "azure.mgmt.hybridcompute.operations.LicenseProfilesOperations.get": "Microsoft.HybridCompute.LicenseProfiles.get", + "azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations.get": "Microsoft.HybridCompute.LicenseProfiles.get", + "azure.mgmt.hybridcompute.operations.LicenseProfilesOperations.begin_create_or_update": "Microsoft.HybridCompute.LicenseProfiles.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations.begin_create_or_update": "Microsoft.HybridCompute.LicenseProfiles.createOrUpdate", + "azure.mgmt.hybridcompute.operations.LicenseProfilesOperations.begin_update": "Microsoft.HybridCompute.LicenseProfiles.update", + "azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations.begin_update": "Microsoft.HybridCompute.LicenseProfiles.update", + "azure.mgmt.hybridcompute.operations.LicenseProfilesOperations.begin_delete": "Microsoft.HybridCompute.LicenseProfiles.delete", + "azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations.begin_delete": "Microsoft.HybridCompute.LicenseProfiles.delete", + "azure.mgmt.hybridcompute.operations.LicenseProfilesOperations.list": "Microsoft.HybridCompute.LicenseProfiles.list", + "azure.mgmt.hybridcompute.aio.operations.LicenseProfilesOperations.list": "Microsoft.HybridCompute.LicenseProfiles.list", + "azure.mgmt.hybridcompute.operations.MachineExtensionsOperations.get": "Microsoft.HybridCompute.MachineExtensions.get", + "azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations.get": "Microsoft.HybridCompute.MachineExtensions.get", + "azure.mgmt.hybridcompute.operations.MachineExtensionsOperations.begin_create_or_update": "Microsoft.HybridCompute.MachineExtensions.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations.begin_create_or_update": "Microsoft.HybridCompute.MachineExtensions.createOrUpdate", + "azure.mgmt.hybridcompute.operations.MachineExtensionsOperations.begin_update": "Microsoft.HybridCompute.MachineExtensions.update", + "azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations.begin_update": "Microsoft.HybridCompute.MachineExtensions.update", + "azure.mgmt.hybridcompute.operations.MachineExtensionsOperations.begin_delete": "Microsoft.HybridCompute.MachineExtensions.delete", + "azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations.begin_delete": "Microsoft.HybridCompute.MachineExtensions.delete", + "azure.mgmt.hybridcompute.operations.MachineExtensionsOperations.list": "Microsoft.HybridCompute.MachineExtensions.list", + "azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations.list": "Microsoft.HybridCompute.MachineExtensions.list", + "azure.mgmt.hybridcompute.operations.MachineRunCommandsOperations.get": "Microsoft.HybridCompute.MachineRunCommands.get", + "azure.mgmt.hybridcompute.aio.operations.MachineRunCommandsOperations.get": "Microsoft.HybridCompute.MachineRunCommands.get", + "azure.mgmt.hybridcompute.operations.MachineRunCommandsOperations.begin_create_or_update": "Microsoft.HybridCompute.MachineRunCommands.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.MachineRunCommandsOperations.begin_create_or_update": "Microsoft.HybridCompute.MachineRunCommands.createOrUpdate", + "azure.mgmt.hybridcompute.operations.MachineRunCommandsOperations.begin_delete": "Microsoft.HybridCompute.MachineRunCommands.delete", + "azure.mgmt.hybridcompute.aio.operations.MachineRunCommandsOperations.begin_delete": "Microsoft.HybridCompute.MachineRunCommands.delete", + "azure.mgmt.hybridcompute.operations.MachineRunCommandsOperations.list": "Microsoft.HybridCompute.MachineRunCommands.list", + "azure.mgmt.hybridcompute.aio.operations.MachineRunCommandsOperations.list": "Microsoft.HybridCompute.MachineRunCommands.list", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.get": "Microsoft.HybridCompute.Gateways.get", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.get": "Microsoft.HybridCompute.Gateways.get", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.begin_create_or_update": "Microsoft.HybridCompute.Gateways.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.begin_create_or_update": "Microsoft.HybridCompute.Gateways.createOrUpdate", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.update": "Microsoft.HybridCompute.Gateways.update", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.update": "Microsoft.HybridCompute.Gateways.update", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.begin_delete": "Microsoft.HybridCompute.Gateways.delete", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.begin_delete": "Microsoft.HybridCompute.Gateways.delete", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.list_by_resource_group": "Microsoft.HybridCompute.Gateways.listByResourceGroup", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.list_by_resource_group": "Microsoft.HybridCompute.Gateways.listByResourceGroup", + "azure.mgmt.hybridcompute.operations.GatewaysOperations.list_by_subscription": "Microsoft.HybridCompute.Gateways.listBySubscription", + "azure.mgmt.hybridcompute.aio.operations.GatewaysOperations.list_by_subscription": "Microsoft.HybridCompute.Gateways.listBySubscription", + "azure.mgmt.hybridcompute.operations.PrivateLinkResourcesOperations.get": "Microsoft.HybridCompute.PrivateLinkResources.get", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkResourcesOperations.get": "Microsoft.HybridCompute.PrivateLinkResources.get", + "azure.mgmt.hybridcompute.operations.PrivateLinkResourcesOperations.list_by_private_link_scope": "Microsoft.HybridCompute.PrivateLinkResources.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkResourcesOperations.list_by_private_link_scope": "Microsoft.HybridCompute.PrivateLinkResources.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.HybridCompute.PrivateEndpointConnections.get", + "azure.mgmt.hybridcompute.aio.operations.PrivateEndpointConnectionsOperations.get": "Microsoft.HybridCompute.PrivateEndpointConnections.get", + "azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.HybridCompute.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.PrivateEndpointConnectionsOperations.begin_create_or_update": "Microsoft.HybridCompute.PrivateEndpointConnections.createOrUpdate", + "azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.HybridCompute.PrivateEndpointConnections.delete", + "azure.mgmt.hybridcompute.aio.operations.PrivateEndpointConnectionsOperations.begin_delete": "Microsoft.HybridCompute.PrivateEndpointConnections.delete", + "azure.mgmt.hybridcompute.operations.PrivateEndpointConnectionsOperations.list_by_private_link_scope": "Microsoft.HybridCompute.PrivateEndpointConnections.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.aio.operations.PrivateEndpointConnectionsOperations.list_by_private_link_scope": "Microsoft.HybridCompute.PrivateEndpointConnections.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.operations.NetworkSecurityPerimeterConfigurationsOperations.get_by_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.getByPrivateLinkScope", + "azure.mgmt.hybridcompute.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.get_by_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.getByPrivateLinkScope", + "azure.mgmt.hybridcompute.operations.NetworkSecurityPerimeterConfigurationsOperations.list_by_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.list_by_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.listByPrivateLinkScope", + "azure.mgmt.hybridcompute.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile_for_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.reconcileForPrivateLinkScope", + "azure.mgmt.hybridcompute.aio.operations.NetworkSecurityPerimeterConfigurationsOperations.begin_reconcile_for_private_link_scope": "Microsoft.HybridCompute.NetworkSecurityPerimeterConfigurations.reconcileForPrivateLinkScope", + "azure.mgmt.hybridcompute.operations.NetworkProfileOperations.get": "Microsoft.HybridCompute.Machines.networkProfileGet", + "azure.mgmt.hybridcompute.aio.operations.NetworkProfileOperations.get": "Microsoft.HybridCompute.Machines.networkProfileGet", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.get_validation_details_for_machine": "Microsoft.HybridCompute.Machines.getValidationDetailsForMachine", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.get_validation_details_for_machine": "Microsoft.HybridCompute.Machines.getValidationDetailsForMachine", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.get": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.get", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.get": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.get", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.create_or_update": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.createOrUpdate", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.create_or_update": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.createOrUpdate", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.update_tags": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.updateTags", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.update_tags": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.updateTags", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.begin_delete": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.delete", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.begin_delete": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.delete", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.list_by_resource_group": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.listByResourceGroup", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.list_by_resource_group": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.listByResourceGroup", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.list": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.list", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.list": "Microsoft.HybridCompute.HybridComputePrivateLinkScopes.list", + "azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations.get_validation_details": "Microsoft.HybridCompute.PrivateLinkScopesOperationGroup.getValidationDetails", + "azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations.get_validation_details": "Microsoft.HybridCompute.PrivateLinkScopesOperationGroup.getValidationDetails", + "azure.mgmt.hybridcompute.operations.ExtensionMetadataOperations.get": "Microsoft.HybridCompute.ExtensionValues.get", + "azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataOperations.get": "Microsoft.HybridCompute.ExtensionValues.get", + "azure.mgmt.hybridcompute.operations.ExtensionMetadataOperations.list": "Microsoft.HybridCompute.ExtensionValues.list", + "azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataOperations.list": "Microsoft.HybridCompute.ExtensionValues.list", + "azure.mgmt.hybridcompute.operations.ExtensionMetadataV2Operations.get": "Microsoft.HybridCompute.ExtensionValueV2s.get", + "azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataV2Operations.get": "Microsoft.HybridCompute.ExtensionValueV2s.get", + "azure.mgmt.hybridcompute.operations.ExtensionMetadataV2Operations.list": "Microsoft.HybridCompute.ExtensionValueV2s.list", + "azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataV2Operations.list": "Microsoft.HybridCompute.ExtensionValueV2s.list", + "azure.mgmt.hybridcompute.operations.SettingsOperations.get": "Microsoft.HybridCompute.SettingsOperationGroup.get", + "azure.mgmt.hybridcompute.aio.operations.SettingsOperations.get": "Microsoft.HybridCompute.SettingsOperationGroup.get", + "azure.mgmt.hybridcompute.operations.SettingsOperations.update": "Microsoft.HybridCompute.SettingsOperationGroup.update", + "azure.mgmt.hybridcompute.aio.operations.SettingsOperations.update": "Microsoft.HybridCompute.SettingsOperationGroup.update", + "azure.mgmt.hybridcompute.operations.SettingsOperations.patch": "Microsoft.HybridCompute.SettingsOperationGroup.patch", + "azure.mgmt.hybridcompute.aio.operations.SettingsOperations.patch": "Microsoft.HybridCompute.SettingsOperationGroup.patch", + "azure.mgmt.hybridcompute.operations.ExtensionTypeOperations.list": "Microsoft.HybridCompute.ExtensionTypeOperationGroup.list", + "azure.mgmt.hybridcompute.aio.operations.ExtensionTypeOperations.list": "Microsoft.HybridCompute.ExtensionTypeOperationGroup.list", + "azure.mgmt.hybridcompute.operations.ExtensionPublisherOperations.list": "Microsoft.HybridCompute.ExtensionPublisherOperationGroup.list", + "azure.mgmt.hybridcompute.aio.operations.ExtensionPublisherOperations.list": "Microsoft.HybridCompute.ExtensionPublisherOperationGroup.list", + "azure.mgmt.hybridcompute.HybridComputeManagementClient.begin_upgrade_extensions": "Microsoft.HybridCompute.Machines.upgradeExtensions", + "azure.mgmt.hybridcompute.aio.HybridComputeManagementClient.begin_upgrade_extensions": "Microsoft.HybridCompute.Machines.upgradeExtensions", + "azure.mgmt.hybridcompute.HybridComputeManagementClient.begin_setup_extensions": "Microsoft.HybridCompute.Machines.setupExtensions", + "azure.mgmt.hybridcompute.aio.HybridComputeManagementClient.begin_setup_extensions": "Microsoft.HybridCompute.Machines.setupExtensions" + }, + "CrossLanguageVersion": "5fed212eb1ee" +} \ No newline at end of file diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/__init__.py index 8db66d3d0f0f..d55ccad1f573 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/__init__.py @@ -1 +1 @@ -__path__ = __import__("pkgutil").extend_path(__path__, __name__) +__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/__init__.py index a3f74a11e9a8..121e4b838fe2 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/__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 ._hybrid_compute_management_client import HybridComputeManagementClient # type: ignore +from ._client import HybridComputeManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_client.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_client.py index 8c491d9e95e2..1c6be5235ce5 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_hybrid_compute_management_client.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_client.py @@ -2,13 +2,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 copy import deepcopy +import sys from typing import Any, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import HttpRequest, HttpResponse @@ -17,7 +17,6 @@ from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import HybridComputeManagementClientConfiguration from ._utils.serialization import Deserializer, Serializer from .operations import ( @@ -26,7 +25,6 @@ ExtensionPublisherOperations, ExtensionTypeOperations, GatewaysOperations, - HybridComputeManagementClientOperationsMixin, LicenseProfilesOperations, LicensesOperations, MachineExtensionsOperations, @@ -39,17 +37,26 @@ PrivateLinkResourcesOperations, PrivateLinkScopesOperations, SettingsOperations, + _HybridComputeManagementClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential class HybridComputeManagementClient( - HybridComputeManagementClientOperationsMixin + _HybridComputeManagementClientOperationsMixin ): # pylint: disable=too-many-instance-attributes - """The Hybrid Compute Management Client. + """Azure Arc( Servers and K8s Clusters) API reference for Private Link's Scopes management. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.hybridcompute.operations.Operations :ivar licenses: LicensesOperations operations :vartype licenses: azure.mgmt.hybridcompute.operations.LicensesOperations :ivar machines: MachinesOperations operations @@ -58,27 +65,10 @@ class HybridComputeManagementClient( :vartype license_profiles: azure.mgmt.hybridcompute.operations.LicenseProfilesOperations :ivar machine_extensions: MachineExtensionsOperations operations :vartype machine_extensions: azure.mgmt.hybridcompute.operations.MachineExtensionsOperations - :ivar extension_metadata: ExtensionMetadataOperations operations - :vartype extension_metadata: azure.mgmt.hybridcompute.operations.ExtensionMetadataOperations - :ivar extension_metadata_v2: ExtensionMetadataV2Operations operations - :vartype extension_metadata_v2: - azure.mgmt.hybridcompute.operations.ExtensionMetadataV2Operations - :ivar extension_type: ExtensionTypeOperations operations - :vartype extension_type: azure.mgmt.hybridcompute.operations.ExtensionTypeOperations - :ivar extension_publisher: ExtensionPublisherOperations operations - :vartype extension_publisher: azure.mgmt.hybridcompute.operations.ExtensionPublisherOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.hybridcompute.operations.Operations - :ivar network_profile: NetworkProfileOperations operations - :vartype network_profile: azure.mgmt.hybridcompute.operations.NetworkProfileOperations :ivar machine_run_commands: MachineRunCommandsOperations operations :vartype machine_run_commands: azure.mgmt.hybridcompute.operations.MachineRunCommandsOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.hybridcompute.operations.GatewaysOperations - :ivar settings: SettingsOperations operations - :vartype settings: azure.mgmt.hybridcompute.operations.SettingsOperations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.hybridcompute.operations.PrivateLinkResourcesOperations @@ -89,29 +79,61 @@ class HybridComputeManagementClient( NetworkSecurityPerimeterConfigurationsOperations operations :vartype network_security_perimeter_configurations: azure.mgmt.hybridcompute.operations.NetworkSecurityPerimeterConfigurationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar network_profile: NetworkProfileOperations operations + :vartype network_profile: azure.mgmt.hybridcompute.operations.NetworkProfileOperations + :ivar private_link_scopes: PrivateLinkScopesOperations operations + :vartype private_link_scopes: azure.mgmt.hybridcompute.operations.PrivateLinkScopesOperations + :ivar extension_metadata: ExtensionMetadataOperations operations + :vartype extension_metadata: azure.mgmt.hybridcompute.operations.ExtensionMetadataOperations + :ivar extension_metadata_v2: ExtensionMetadataV2Operations operations + :vartype extension_metadata_v2: + azure.mgmt.hybridcompute.operations.ExtensionMetadataV2Operations + :ivar settings: SettingsOperations operations + :vartype settings: azure.mgmt.hybridcompute.operations.SettingsOperations + :ivar extension_type: ExtensionTypeOperations operations + :vartype extension_type: azure.mgmt.hybridcompute.operations.ExtensionTypeOperations + :ivar extension_publisher: ExtensionPublisherOperations operations + :vartype extension_publisher: azure.mgmt.hybridcompute.operations.ExtensionPublisherOperations + :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-02-19-preview". Note that overriding - this default value may result in unsupported behavior. + :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. Known values are + "2025-09-16-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "TokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _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 = HybridComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -132,12 +154,12 @@ 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.licenses = LicensesOperations(self._client, self._config, self._serialize, self._deserialize) self.machines = MachinesOperations(self._client, self._config, self._serialize, self._deserialize) self.license_profiles = LicenseProfilesOperations( @@ -146,43 +168,42 @@ def __init__( self.machine_extensions = MachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_metadata = ExtensionMetadataOperations( + self.machine_run_commands = MachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_metadata_v2 = ExtensionMetadataV2Operations( + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_type = ExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) - self.extension_publisher = ExtensionPublisherOperations( + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) - self.machine_run_commands = MachineRunCommandsOperations( + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.settings = SettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_scopes = PrivateLinkScopesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_link_resources = PrivateLinkResourcesOperations( + self.extension_metadata = ExtensionMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self.extension_metadata_v2 = ExtensionMetadataV2Operations( self._client, self._config, self._serialize, self._deserialize ) - self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self.settings = SettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type = ExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_publisher = ExtensionPublisherOperations( 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 @@ -195,7 +216,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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py index 737612c3c7dc..b81275756c09 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_configuration.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. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy @@ -14,6 +14,7 @@ from ._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials import TokenCredential @@ -23,17 +24,31 @@ class HybridComputeManagementClientConfiguration: # pylint: disable=too-many-in 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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-02-19-preview". Note that overriding - this default value may result in unsupported behavior. + :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. Known values are + "2025-09-16-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-02-19-preview") + 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-09-16-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +57,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs 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-hybridcompute/{}".format(VERSION)) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_patch.py index f7dd32510333..ea765788358a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_patch.py @@ -1,14 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_types.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_types.py new file mode 100644 index 000000000000..7d3cc018101f --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_types.py @@ -0,0 +1,11 @@ +# 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. +# -------------------------------------------------------------------------- + +from typing import Union + +ServiceExtensionType = str diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/__init__.py index 0af9b28f6607..8026245c2abc 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/model_base.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/model_base.py new file mode 100644 index 000000000000..d725c55906d3 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/model_base.py @@ -0,0 +1,1737 @@ +# 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 +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 + +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + +_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: + if isinstance(other, _MyMutableMapping): + return self._data == other._data + 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) + + +# ============================================================================ +# Fast-path scalar deserializer functions for rest_field(deserializer=...) +# These are referenced from rest_field declarations to bypass the generic +# _deserialize -> _deserialize_with_callable chain. +# Only simple/primitive types — no models or container types. +# ============================================================================ + + +def _xml_deser_str(value): + if isinstance(value, ET.Element): + return value.text or "" + return str(value) if value is not None else None + + +def _xml_deser_int(value): + if isinstance(value, ET.Element): + return int(value.text) if value.text else None + return int(value) if value is not None else None + + +def _xml_deser_float(value): + if isinstance(value, ET.Element): + return float(value.text) if value.text else None + return float(value) if value is not None else None + + +def _xml_deser_bool(value): + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + if text in (True, False): + return text + return text.lower() == "true" + + +# pylint: disable=docstring-missing-param +def _xml_deser_bytes(value): + """Deserialize bytes from XML (base64).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes(text) + + +def _xml_deser_bytes_base64url(value): + """Deserialize bytes from XML (base64url).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_bytes_base64(text) + + +def _xml_deser_datetime(value): + """Deserialize a datetime from XML (ISO 8601 / rfc3339).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime(text) + + +def _xml_deser_datetime_rfc7231(value): + """Deserialize a datetime from XML (RFC7231 format).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_rfc7231(text) + + +def _xml_deser_datetime_unix_timestamp(value): + """Deserialize a datetime from XML (Unix timestamp).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_datetime_unix_timestamp(float(text)) + + +def _xml_deser_date(value): + """Deserialize a date from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_date(text) + + +def _xml_deser_time(value): + """Deserialize a time from XML (ISO 8601).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_time(text) + + +def _xml_deser_duration(value): + """Deserialize a timedelta from XML (ISO 8601 duration).""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_duration(text) + + +def _xml_deser_decimal(value): + """Deserialize a Decimal from XML.""" + if isinstance(value, ET.Element): + text = value.text + else: + text = value + if text is None: + return None + return _deserialize_decimal(text) + + +def _xml_deser_enum_or_str(enum_cls, value): + """Deserialize a Union[EnumType, str] from XML.""" + text = value.text if isinstance(value, ET.Element) else value + if text is None: + return None + try: + return enum_cls(text) + except ValueError: + return text + + +def _extract_xml_model_type(rf_type): + """Extract the concrete Model class from a resolved rf._type partial chain. + + Unwraps ``Optional[Model]`` and ``_deserialize_model(Model, ...)`` + wrappers. Only handles Model and Optional[Model] — other composite + types (List, Dict, Union, etc.) return None and fall through to the + generic ``_deserialize`` path at runtime. + """ + if rf_type is None: + return None + if isinstance(rf_type, type) and _is_model(rf_type): + return rf_type + if not isinstance(rf_type, functools.partial): + return None + func = rf_type.func + args = rf_type.args + if func is _deserialize_with_optional and args: + return _extract_xml_model_type(args[0]) + if func is _deserialize_model and args: + cls = args[0] + return cls if isinstance(cls, type) and _is_model(cls) else None + return None + + +def _build_xml_field_plan( # pylint: disable=docstring-missing-return, docstring-missing-rtype, unused-variable + cls, attr_to_rest_field: dict +) -> list: + """Build a precomputed XML field plan for fast _init_from_xml iteration. + + Called once per model class in __new__. Returns a list of tuples: + (rest_name, xml_name, kind, deser, rf_type, is_optional, items_name) + + kind: 0=wrapped, 1=attribute, 2=unwrapped, 3=text + + For Model and Optional[Model] fields that lack a scalar + ``_deserializer``, this function precomputes the Model class as the + deserializer so ``_init_from_xml`` can call ``ModelClass(element)`` + directly instead of going through the expensive + ``_get_deserialize_callable_from_annotation`` chain at runtime. + """ + model_meta = getattr(cls, "_xml", {}) + model_ns = model_meta.get("ns") or model_meta.get("namespace") + plan = [] + + for rf in attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + deser = rf._deserializer + + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + is_optional = rf._is_optional + + # For Model / Optional[Model] fields without a scalar deserializer, + # precompute the Model class as the deserializer. + if deser is None and rf._type is not None: + model_cls = _extract_xml_model_type(rf._type) + if model_cls is not None: + deser = model_cls + + if prop_meta.get("attribute", False): + plan.append((rf._rest_name, xml_name, 1, deser, rf._type, is_optional, None)) + elif prop_meta.get("unwrapped", False): + items_name = prop_meta.get("itemsName") + if items_name: + items_ns = prop_meta.get("itemsNs") + if items_ns is not None: + xml_ns = items_ns + if xml_ns: + items_name = "{" + xml_ns + "}" + items_name + else: + items_name = xml_name + plan.append((rf._rest_name, xml_name, 2, deser, rf._type, is_optional, items_name)) + elif prop_meta.get("text", False): + plan.append((rf._rest_name, xml_name, 3, deser, rf._type, is_optional, None)) + else: + plan.append((rf._rest_name, xml_name, 0, deser, rf._type, is_optional, None)) + + return plan + + +# pylint: enable=docstring-missing-param +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: dict[str, typing.Any] = {} + if args: + if isinstance(args[0], ET.Element): + dict_to_pass.update(self._init_from_xml(args[0])) + 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 + } + ) + # Apply client default values for fields the caller didn't set so that + # defaults are part of `_data` and therefore included during serialization. + for rf in self._attr_to_rest_field.values(): + if rf._default is _UNSET: + continue + if rf._rest_name in dict_to_pass: + continue + dict_to_pass[rf._rest_name] = _create_value(rf, rf._default) + super().__init__(dict_to_pass) + + def _init_from_xml( # pylint: disable=too-many-branches, too-many-statements + self, element: ET.Element + ) -> dict[str, typing.Any]: + """Deserialize an XML element into a dict mapping rest field names to values. + + :param ET.Element element: The XML element to deserialize from. + :returns: A dictionary of rest_name to deserialized value pairs. + :rtype: dict + """ + result: dict[str, typing.Any] = {} + existed_attr_keys: list[str] = [] + + field_plan = getattr(self, "_xml_field_plan", None) + if field_plan: + for rest_name, xml_name, kind, deser, rf_type, is_optional, items_name in field_plan: + if kind == 0: # wrapped element (most common) + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(item) + else: + result[rest_name] = _deserialize(rf_type, item) + elif kind == 1: # attribute + attr_val = element.get(xml_name) + if attr_val is not None: + existed_attr_keys.append(xml_name) + if deser: + result[rest_name] = deser(attr_val) + else: + result[rest_name] = attr_val + elif kind == 2: # unwrapped array + items = element.findall(items_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(items_name) + if deser: + result[rest_name] = deser(items) + else: + result[rest_name] = _deserialize(rf_type, items) + elif not is_optional: + existed_attr_keys.append(items_name) + result[rest_name] = [] + elif kind == 3: # text + if element.text is not None: + if deser: + result[rest_name] = deser(element.text) + else: + result[rest_name] = element.text + else: + 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 = _resolve_xml_ns(prop_meta, model_meta) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and element.get(xml_name) is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, element.get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + _items_name = prop_meta.get("itemsName") + if _items_name: + xml_name = _items_name + _items_ns = prop_meta.get("itemsNs") + if _items_ns is not None: + xml_ns = _items_ns + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = element.findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, items) + elif not rf._is_optional: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = [] + continue + + # text element is primitive type + if prop_meta.get("text", False): + if element.text is not None: + result[rf._rest_name] = _deserialize(rf._type, element.text) + continue + + # wrapped element could be normal property or array + item = element.find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + result[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in element: + if e.tag not in existed_attr_keys: + result[e.tag] = _convert_element(e) + + return result + + 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()) + # Build XML field plan for fast _init_from_xml (only for XML models) + if getattr(cls, "_xml", None): + cls._xml_field_plan = _build_xml_field_plan(cls, attr_to_rest_field) + 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 = _resolve_xml_ns(prop_meta, model_meta) + 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 _is_array_encoded_deserializer(deserializer: functools.partial) -> bool: + return ( + isinstance(deserializer, functools.partial) + and isinstance(deserializer.args[0], functools.partial) + and deserializer.args[0].func == _deserialize_array_encoded # pylint: disable=comparison-with-callable + ) + + +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) + + # encoded string may be deserialized to sequence + if isinstance(obj, str) and isinstance(deserializer, functools.partial): + # for list[str] + if _is_array_encoded_deserializer(deserializer): + return deserializer(obj) + + # for list[Union[...]] + if isinstance(deserializer.args[0], list): + for sub_deserializer in deserializer.args[0]: + if _is_array_encoded_deserializer(sub_deserializer): + return sub_deserializer(obj) + + 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 rf: + rf._is_optional = True + 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 and deserializer in _DESERIALIZE_MAPPING.values(): + return deserializer(value.text) if value.text else None + if deserializer and deserializer in _DESERIALIZE_MAPPING_WITHFORMAT.values(): + return deserializer(value.text) 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.text if isinstance(value, ET.Element) else value) + except ValueError: + # for unknown value, return raw value + return value.text if isinstance(value, ET.Element) else 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 Exception: # pylint: disable=broad-except + _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 Exception: # pylint: disable=broad-except + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +# pylint: disable=too-many-instance-attributes +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, + deserializer: typing.Optional[typing.Callable] = 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._is_optional = 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 {} + self._deserializer = deserializer + + @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, _UNSET) + if item is _UNSET: + # Field not set by user; return the client default if one exists, otherwise None + return self._default if self._default is not _UNSET else None + 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) + + # Fast path: use _deserializer directly (avoids _serialize/_deserialize chain) + if self._deserializer: + deserialized = self._deserializer(item) + else: + 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, + deserializer: typing.Optional[typing.Callable] = 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, + deserializer=deserializer, + ) + + +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_xml_ns(meta: dict[str, typing.Any]) -> typing.Optional[str]: + """Return the XML namespace from a metadata dict, checking both 'ns' (old-style) and 'namespace' (DPG) keys. + + :param dict meta: The metadata dictionary to extract namespace from. + :returns: The namespace string if 'ns' or 'namespace' key is present, None otherwise. + :rtype: str or None + """ + ns = meta.get("ns") + if ns is None: + ns = meta.get("namespace") + return ns + + +def _resolve_xml_ns( + prop_meta: dict[str, typing.Any], model_meta: typing.Optional[dict[str, typing.Any]] = None +) -> typing.Optional[str]: + """Resolve XML namespace for a property, falling back to model namespace when appropriate. + + Checks the property metadata first; if no namespace is found and the model does not declare + an explicit prefix, falls back to the model-level namespace. + + :param dict prop_meta: The property metadata dictionary. + :param dict model_meta: The model metadata dictionary, used as fallback. + :returns: The resolved namespace string, or None. + :rtype: str or None + """ + ns = _get_xml_ns(prop_meta) + if ns is None and model_meta is not None and not model_meta.get("prefix"): + ns = _get_xml_ns(model_meta) + return ns + + +def _set_xml_attribute(element: ET.Element, name: str, value: typing.Any, prop_meta: dict[str, typing.Any]) -> None: + """Set an XML attribute on an element, handling namespace prefix registration. + + :param ET.Element element: The element to set the attribute on. + :param str name: The default attribute name (wire name). + :param any value: The attribute value. + :param dict prop_meta: The property metadata dictionary. + """ + xml_name = prop_meta.get("name", name) + _attr_ns = _get_xml_ns(prop_meta) + if _attr_ns: + _attr_prefix = prop_meta.get("prefix") + if _attr_prefix: + _safe_register_namespace(_attr_prefix, _attr_ns) + xml_name = "{" + _attr_ns + "}" + xml_name + element.set(xml_name, _get_primitive_type_value(value)) + + +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: + # When serializing as an array item (parent_meta is set), check if the parent has an + # explicit itemsName. This ensures correct element names for unwrapped arrays (where + # the element tag is the property/items name, not the model type name). + _items_name = parent_meta.get("itemsName") if parent_meta is not None else None + element_name = _items_name if _items_name else (model_meta.get("name") or o.__class__.__name__) + _model_ns = _get_xml_ns(model_meta) + wrapped_element = _create_xml_element( + element_name, + model_meta.get("prefix"), + _model_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} + + # Propagate model namespace to properties only for old-style "ns"-keyed models. + # DPG-generated models use the "namespace" key and explicitly declare namespace on + # each property that needs it, so propagation is intentionally skipped for them. + 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): + _set_xml_attribute(wrapped_element, k, v, prop_meta) + 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 = [] + _dict_ns = _get_xml_ns(parent_meta) if parent_meta else None + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": _dict_ns, + "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: + _items_ns = parent_meta.get("itemsNs") + if _items_ns is None: + _items_ns = _get_xml_ns(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": _items_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: + _meta_ns = _get_xml_ns(meta) if meta else None + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, _meta_ns + ) + 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 _safe_register_namespace(prefix: str, ns: str) -> None: + """Register an XML namespace prefix, handling reserved prefix patterns. + + Some prefixes (e.g. 'ns2') match Python's reserved 'ns\\d+' pattern used for + auto-generated prefixes, causing register_namespace to raise ValueError. + Falls back to directly registering in the internal namespace map. + + :param str prefix: The namespace prefix to register. + :param str ns: The namespace URI. + """ + try: + ET.register_namespace(prefix, ns) + except ValueError: + _ns_map = getattr(ET, "_namespace_map", None) + if _ns_map is not None: + _ns_map[ns] = prefix + + +def _create_xml_element( + tag: typing.Any, prefix: typing.Optional[str] = None, ns: typing.Optional[str] = None +) -> ET.Element: + if prefix and ns: + _safe_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 + if _is_model(deserializer): + return deserializer._deserialize(element, []) + 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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/serialization.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/serialization.py index f5187701d7be..a088671e9c51 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/serialization.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_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. # -------------------------------------------------------------------------- @@ -21,7 +21,6 @@ import sys import codecs from typing import ( - Dict, Any, cast, Optional, @@ -31,7 +30,6 @@ Mapping, Callable, MutableMapping, - List, ) try: @@ -41,11 +39,15 @@ import xml.etree.ElementTree as ET import isodate # type: ignore -from typing_extensions import Self from azure.core.exceptions import DeserializationError, SerializationError from azure.core.serialization import NULL as CoreNull +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self + _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") JSON = MutableMapping[str, Any] @@ -229,12 +231,12 @@ class Model: serialization and deserialization. """ - _subtype_map: Dict[str, Dict[str, Any]] = {} - _attribute_map: Dict[str, Dict[str, Any]] = {} - _validation: Dict[str, Dict[str, Any]] = {} + _subtype_map: dict[str, dict[str, Any]] = {} + _attribute_map: dict[str, dict[str, Any]] = {} + _validation: dict[str, dict[str, Any]] = {} def __init__(self, **kwargs: Any) -> None: - self.additional_properties: Optional[Dict[str, Any]] = {} + self.additional_properties: Optional[dict[str, Any]] = {} for k in kwargs: # pylint: disable=consider-using-dict-items if k not in self._attribute_map: _LOGGER.warning("%s is not a known attribute of class %s and will be ignored", k, self.__class__) @@ -311,7 +313,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, + key_transformer: Callable[[str, dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -380,7 +382,7 @@ def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: def from_dict( cls, data: Any, - key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, + key_extractors: Optional[Callable[[str, dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, ) -> Self: """Parse a dict using given key extractor return a model. @@ -414,7 +416,7 @@ def _flatten_subtype(cls, key, objects): return {} result = dict(cls._subtype_map[key]) for valuetype in cls._subtype_map[key].values(): - result.update(objects[valuetype]._flatten_subtype(key, objects)) # pylint: disable=protected-access + result |= objects[valuetype]._flatten_subtype(key, objects) # pylint: disable=protected-access return result @classmethod @@ -528,7 +530,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "[]": self.serialize_iter, "{}": self.serialize_dict, } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_transformer = full_restapi_key_transformer self.client_side_validation = True @@ -579,7 +581,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to if attr_name == "additional_properties" and attr_desc["key"] == "": if target_obj.additional_properties is not None: - serialized.update(target_obj.additional_properties) + serialized |= target_obj.additional_properties continue try: @@ -789,7 +791,7 @@ def serialize_data(self, data, data_type, **kwargs): # If dependencies is empty, try with current data class # It has to be a subclass of Enum anyway - enum_type = self.dependencies.get(data_type, data.__class__) + enum_type = self.dependencies.get(data_type, cast(type, data.__class__)) if issubclass(enum_type, Enum): return Serializer.serialize_enum(data, enum_obj=enum_type) @@ -823,13 +825,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): @@ -1184,7 +1193,7 @@ def rest_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argumen while "." in key: # Need the cast, as for some reasons "split" is typed as list[str | Any] - dict_keys = cast(List[str], _FLATTEN.split(key)) + dict_keys = cast(list[str], _FLATTEN.split(key)) if len(dict_keys) == 1: key = _decode_attribute_map_key(dict_keys[0]) break @@ -1386,7 +1395,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: "duration": (isodate.Duration, datetime.timedelta), "iso-8601": (datetime.datetime), } - self.dependencies: Dict[str, type] = dict(classes) if classes else {} + self.dependencies: dict[str, type] = dict(classes) if classes else {} self.key_extractors = [rest_key_extractor, xml_key_extractor] # Additional properties only works if the "rest_key_extractor" is used to # extract the keys. Making it to work whatever the key extractor is too much @@ -1396,7 +1405,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None: # Otherwise, result are unexpected self.additional_properties_detection = True - def __call__(self, target_obj, response_data, content_type=None): + def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements """Call the deserializer to process a REST response. :param str target_obj: Target data type to deserialize to. @@ -1406,6 +1415,27 @@ def __call__(self, target_obj, response_data, content_type=None): :return: Deserialized object. :rtype: object """ + # Fast path for header deserialization: response_data is a plain str or None + # and target_obj is a simple scalar type. This avoids the expensive + # _unpack_content → _deserialize → _classify_target → deserialize_data chain. + if response_data is None: + return None + if target_obj == "str" and isinstance(response_data, str): + return response_data + if isinstance(response_data, str): + if target_obj == "int": + return int(response_data) + if target_obj == "bool": + if response_data in ("true", "1", "True"): + return True + if response_data in ("false", "0", "False"): + return False + return bool(response_data) + if target_obj == "rfc-1123": + return Deserializer.deserialize_rfc(response_data) + if target_obj == "bytearray": + return Deserializer.deserialize_bytearray(response_data) + data = self._unpack_content(response_data, content_type) return self._deserialize(target_obj, data) @@ -1759,7 +1789,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 @@ -1785,7 +1815,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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/utils.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/utils.py index 39b612f39a9b..35c9c836f85f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/utils.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_utils/utils.py @@ -1,7 +1,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. # -------------------------------------------------------------------------- diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py index 7419d7214922..191229873896 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/_version.py @@ -2,8 +2,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. # -------------------------------------------------------------------------- -VERSION = "9.1.0b2" +VERSION = "9.1.0b3" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/__init__.py index 457fdd1a4ff4..a534ab714c62 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/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 ._hybrid_compute_management_client import HybridComputeManagementClient # type: ignore +from ._client import HybridComputeManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_client.py similarity index 82% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_client.py index 8d2a1dd554a8..79df24b8f42d 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_hybrid_compute_management_client.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_client.py @@ -2,13 +2,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 copy import deepcopy +import sys from typing import Any, Awaitable, Optional, TYPE_CHECKING, cast -from typing_extensions import Self from azure.core.pipeline import policies from azure.core.rest import AsyncHttpResponse, HttpRequest @@ -17,7 +17,6 @@ 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 HybridComputeManagementClientConfiguration from .operations import ( @@ -26,7 +25,6 @@ ExtensionPublisherOperations, ExtensionTypeOperations, GatewaysOperations, - HybridComputeManagementClientOperationsMixin, LicenseProfilesOperations, LicensesOperations, MachineExtensionsOperations, @@ -39,17 +37,26 @@ PrivateLinkResourcesOperations, PrivateLinkScopesOperations, SettingsOperations, + _HybridComputeManagementClientOperationsMixin, ) +if sys.version_info >= (3, 11): + from typing import Self +else: + from typing_extensions import Self # type: ignore + if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential class HybridComputeManagementClient( - HybridComputeManagementClientOperationsMixin + _HybridComputeManagementClientOperationsMixin ): # pylint: disable=too-many-instance-attributes - """The Hybrid Compute Management Client. + """Azure Arc( Servers and K8s Clusters) API reference for Private Link's Scopes management. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.hybridcompute.aio.operations.Operations :ivar licenses: LicensesOperations operations :vartype licenses: azure.mgmt.hybridcompute.aio.operations.LicensesOperations :ivar machines: MachinesOperations operations @@ -59,31 +66,11 @@ class HybridComputeManagementClient( :ivar machine_extensions: MachineExtensionsOperations operations :vartype machine_extensions: azure.mgmt.hybridcompute.aio.operations.MachineExtensionsOperations - :ivar extension_metadata: ExtensionMetadataOperations operations - :vartype extension_metadata: - azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataOperations - :ivar extension_metadata_v2: ExtensionMetadataV2Operations operations - :vartype extension_metadata_v2: - azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataV2Operations - :ivar extension_type: ExtensionTypeOperations operations - :vartype extension_type: azure.mgmt.hybridcompute.aio.operations.ExtensionTypeOperations - :ivar extension_publisher: ExtensionPublisherOperations operations - :vartype extension_publisher: - azure.mgmt.hybridcompute.aio.operations.ExtensionPublisherOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.hybridcompute.aio.operations.Operations - :ivar network_profile: NetworkProfileOperations operations - :vartype network_profile: azure.mgmt.hybridcompute.aio.operations.NetworkProfileOperations :ivar machine_run_commands: MachineRunCommandsOperations operations :vartype machine_run_commands: azure.mgmt.hybridcompute.aio.operations.MachineRunCommandsOperations :ivar gateways: GatewaysOperations operations :vartype gateways: azure.mgmt.hybridcompute.aio.operations.GatewaysOperations - :ivar settings: SettingsOperations operations - :vartype settings: azure.mgmt.hybridcompute.aio.operations.SettingsOperations - :ivar private_link_scopes: PrivateLinkScopesOperations operations - :vartype private_link_scopes: - azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations :ivar private_link_resources: PrivateLinkResourcesOperations operations :vartype private_link_resources: azure.mgmt.hybridcompute.aio.operations.PrivateLinkResourcesOperations @@ -94,29 +81,64 @@ class HybridComputeManagementClient( NetworkSecurityPerimeterConfigurationsOperations operations :vartype network_security_perimeter_configurations: azure.mgmt.hybridcompute.aio.operations.NetworkSecurityPerimeterConfigurationsOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar network_profile: NetworkProfileOperations operations + :vartype network_profile: azure.mgmt.hybridcompute.aio.operations.NetworkProfileOperations + :ivar private_link_scopes: PrivateLinkScopesOperations operations + :vartype private_link_scopes: + azure.mgmt.hybridcompute.aio.operations.PrivateLinkScopesOperations + :ivar extension_metadata: ExtensionMetadataOperations operations + :vartype extension_metadata: + azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataOperations + :ivar extension_metadata_v2: ExtensionMetadataV2Operations operations + :vartype extension_metadata_v2: + azure.mgmt.hybridcompute.aio.operations.ExtensionMetadataV2Operations + :ivar settings: SettingsOperations operations + :vartype settings: azure.mgmt.hybridcompute.aio.operations.SettingsOperations + :ivar extension_type: ExtensionTypeOperations operations + :vartype extension_type: azure.mgmt.hybridcompute.aio.operations.ExtensionTypeOperations + :ivar extension_publisher: ExtensionPublisherOperations operations + :vartype extension_publisher: + azure.mgmt.hybridcompute.aio.operations.ExtensionPublisherOperations + :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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :param base_url: Service URL. Default value is None. + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2025-02-19-preview". Note that overriding - this default value may result in unsupported behavior. + :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. Known values are + "2025-09-16-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + *, + cloud_setting: Optional["AzureClouds"] = None, + **kwargs: Any ) -> None: - _cloud = kwargs.pop("cloud_setting", None) or settings.current.azure_cloud # type: ignore + _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 = HybridComputeManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, credential_scopes=credential_scopes, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + cloud_setting=cloud_setting, + credential_scopes=credential_scopes, + **kwargs ) _policies = kwargs.pop("policies", None) @@ -138,13 +160,13 @@ 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.licenses = LicensesOperations(self._client, self._config, self._serialize, self._deserialize) self.machines = MachinesOperations(self._client, self._config, self._serialize, self._deserialize) self.license_profiles = LicenseProfilesOperations( @@ -153,37 +175,36 @@ def __init__( self.machine_extensions = MachineExtensionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_metadata = ExtensionMetadataOperations( + self.machine_run_commands = MachineRunCommandsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_metadata_v2 = ExtensionMetadataV2Operations( + self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) + self.private_link_resources = PrivateLinkResourcesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.extension_type = ExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) - self.extension_publisher = ExtensionPublisherOperations( + self.private_endpoint_connections = PrivateEndpointConnectionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) - self.machine_run_commands = MachineRunCommandsOperations( + self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.gateways = GatewaysOperations(self._client, self._config, self._serialize, self._deserialize) - self.settings = SettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.network_profile = NetworkProfileOperations(self._client, self._config, self._serialize, self._deserialize) self.private_link_scopes = PrivateLinkScopesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_link_resources = PrivateLinkResourcesOperations( + self.extension_metadata = ExtensionMetadataOperations( self._client, self._config, self._serialize, self._deserialize ) - self.private_endpoint_connections = PrivateEndpointConnectionsOperations( + self.extension_metadata_v2 = ExtensionMetadataV2Operations( self._client, self._config, self._serialize, self._deserialize ) - self.network_security_perimeter_configurations = NetworkSecurityPerimeterConfigurationsOperations( + self.settings = SettingsOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_type = ExtensionTypeOperations(self._client, self._config, self._serialize, self._deserialize) + self.extension_publisher = ExtensionPublisherOperations( 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. @@ -191,7 +212,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 @@ -204,7 +225,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/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py index eabe3f32e321..5cf3db906148 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_configuration.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. # -------------------------------------------------------------------------- -from typing import Any, TYPE_CHECKING +from typing import Any, Optional, TYPE_CHECKING from azure.core.pipeline import policies from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy @@ -14,6 +14,7 @@ from .._version import VERSION if TYPE_CHECKING: + from azure.core import AzureClouds from azure.core.credentials_async import AsyncTokenCredential @@ -23,17 +24,31 @@ class HybridComputeManagementClientConfiguration: # pylint: disable=too-many-in 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. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str - :keyword api_version: Api Version. Default value is "2025-02-19-preview". Note that overriding - this default value may result in unsupported behavior. + :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. Known values are + "2025-09-16-preview" and None. Default value is None. If not set, the operation's default API + version will be used. Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2025-02-19-preview") + 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-09-16-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +57,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k 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-hybridcompute/{}".format(VERSION)) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_patch.py index f7dd32510333..ea765788358a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/_patch.py @@ -1,14 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py index a0baad3418e2..01f5d6d02c71 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/__init__.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. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,48 +12,47 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._licenses_operations import LicensesOperations # type: ignore -from ._machines_operations import MachinesOperations # type: ignore -from ._license_profiles_operations import LicenseProfilesOperations # type: ignore -from ._machine_extensions_operations import MachineExtensionsOperations # type: ignore -from ._hybrid_compute_management_client_operations import HybridComputeManagementClientOperationsMixin # type: ignore -from ._extension_metadata_operations import ExtensionMetadataOperations # type: ignore -from ._extension_metadata_v2_operations import ExtensionMetadataV2Operations # type: ignore -from ._extension_type_operations import ExtensionTypeOperations # type: ignore -from ._extension_publisher_operations import ExtensionPublisherOperations # type: ignore from ._operations import Operations # type: ignore -from ._network_profile_operations import NetworkProfileOperations # type: ignore -from ._machine_run_commands_operations import MachineRunCommandsOperations # type: ignore -from ._gateways_operations import GatewaysOperations # type: ignore -from ._settings_operations import SettingsOperations # type: ignore -from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import LicensesOperations # type: ignore +from ._operations import MachinesOperations # type: ignore +from ._operations import LicenseProfilesOperations # type: ignore +from ._operations import MachineExtensionsOperations # type: ignore +from ._operations import MachineRunCommandsOperations # type: ignore +from ._operations import GatewaysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import NetworkProfileOperations # type: ignore +from ._operations import PrivateLinkScopesOperations # type: ignore +from ._operations import ExtensionMetadataOperations # type: ignore +from ._operations import ExtensionMetadataV2Operations # type: ignore +from ._operations import SettingsOperations # type: ignore +from ._operations import ExtensionTypeOperations # type: ignore +from ._operations import ExtensionPublisherOperations # type: ignore +from ._operations import _HybridComputeManagementClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", "LicensesOperations", "MachinesOperations", "LicenseProfilesOperations", "MachineExtensionsOperations", - "HybridComputeManagementClientOperationsMixin", - "ExtensionMetadataOperations", - "ExtensionMetadataV2Operations", - "ExtensionTypeOperations", - "ExtensionPublisherOperations", - "Operations", - "NetworkProfileOperations", "MachineRunCommandsOperations", "GatewaysOperations", - "SettingsOperations", - "PrivateLinkScopesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "NetworkSecurityPerimeterConfigurationsOperations", + "NetworkProfileOperations", + "PrivateLinkScopesOperations", + "ExtensionMetadataOperations", + "ExtensionMetadataV2Operations", + "SettingsOperations", + "ExtensionTypeOperations", + "ExtensionPublisherOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py deleted file mode 100644 index 767bcfdf40f7..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_operations.py +++ /dev/null @@ -1,207 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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._extension_metadata_operations import build_get_request, build_list_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExtensionMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`extension_metadata` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any - ) -> _models.ExtensionValue: - """Gets an Extension Metadata based on location, publisher, extensionType and version. - - :param location: The location of the Extension being received. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :param version: The version of the Extension being received. Required. - :type version: str - :return: ExtensionValue or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue - :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", self._config.api_version)) - cls: ClsType[_models.ExtensionValue] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher=publisher, - extension_type=extension_type, - version=version, - 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("ExtensionValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, location: str, publisher: str, extension_type: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ExtensionValue"]: - """Gets all Extension versions based on location, publisher, extensionType. - - :param location: The location of the Extension being received. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :return: An iterator like instance of either ExtensionValue or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionValueListResult] = 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( - location=location, - publisher=publisher, - extension_type=extension_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionValueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_v2_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_v2_operations.py deleted file mode 100644 index d623705f0689..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_metadata_v2_operations.py +++ /dev/null @@ -1,205 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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._extension_metadata_v2_operations import build_get_request, build_list_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExtensionMetadataV2Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`extension_metadata_v2` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any - ) -> _models.ExtensionValueV2: - """Gets an Extension Metadata based on location, publisher, extensionType and version. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :param version: The version of the Extension being received. Required. - :type version: str - :return: ExtensionValueV2 or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValueV2 - :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", self._config.api_version)) - cls: ClsType[_models.ExtensionValueV2] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher=publisher, - extension_type=extension_type, - version=version, - 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("ExtensionValueV2", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, location: str, publisher: str, extension_type: str, **kwargs: Any - ) -> AsyncItemPaged["_models.ExtensionValueV2"]: - """Gets all Extension versions based on location, publisher, extensionType. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :return: An iterator like instance of either ExtensionValueV2 or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValueV2] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionValueListResultV2] = 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( - location=location, - publisher=publisher, - extension_type=extension_type, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionValueListResultV2", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_publisher_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_publisher_operations.py deleted file mode 100644 index d0633ef38b0f..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_publisher_operations.py +++ /dev/null @@ -1,134 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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.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._extension_publisher_operations import build_list_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExtensionPublisherOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`extension_publisher` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, **kwargs: Any) -> AsyncItemPaged["_models.ExtensionPublisher"]: - """Gets all Extension publishers based on the location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either ExtensionPublisher or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionPublisher] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionPublisherListResult] = 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( - location=location, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionPublisherListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_type_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_type_operations.py deleted file mode 100644 index f0e7313537a1..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_extension_type_operations.py +++ /dev/null @@ -1,136 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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.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._extension_type_operations import build_list_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ExtensionTypeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`extension_type` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, **kwargs: Any) -> AsyncItemPaged["_models.ExtensionType"]: - """Gets all Extension types based on location and publisher. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :return: An iterator like instance of either ExtensionType or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionTypeListResult] = 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( - location=location, - publisher=publisher, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionTypeListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_gateways_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_gateways_operations.py deleted file mode 100644 index b519bc656c61..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_gateways_operations.py +++ /dev/null @@ -1,713 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._gateways_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`gateways` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _create_or_update_initial( - self, resource_group_name: str, gateway_name: str, parameters: Union[_models.Gateway, 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", self._config.api_version)) - 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, "Gateway") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - gateway_name: str, - parameters: _models.Gateway, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Gateway - :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 Gateway or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - gateway_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, gateway_name: str, parameters: Union[_models.Gateway, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. Is either a Gateway - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Gateway or IO[bytes] - :return: An instance of AsyncLROPoller that returns either Gateway or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gateway] = 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, - gateway_name=gateway_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): - deserialized = self._deserialize("Gateway", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Gateway].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Gateway]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: _models.GatewayUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: Union[_models.GatewayUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. Is either a - GatewayUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate or IO[bytes] - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gateway] = 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, "GatewayUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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("Gateway", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.Gateway: - """Retrieves information about the view of a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :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", self._config.api_version)) - cls: ClsType[_models.Gateway] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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("Gateway", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial(self, resource_group_name: str, gateway_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, gateway_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to delete a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - gateway_name=gateway_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, **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.Gateway"]: - """The operation to get all gateways of a non-Azure machine. - - :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 Gateway or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.GatewaysListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewaysListResult", 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_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Gateway"]: - """The operation to get all gateways of a non-Azure machine. - - :return: An iterator like instance of either Gateway or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.GatewaysListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("GatewaysListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py deleted file mode 100644 index 61f87c82dc45..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_hybrid_compute_management_client_operations.py +++ /dev/null @@ -1,447 +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, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload - -from azure.core import AsyncPipelineClient -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_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.utils import ClientMixinABC -from ...operations._hybrid_compute_management_client_operations import ( - build_setup_extensions_request, - build_upgrade_extensions_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class HybridComputeManagementClientOperationsMixin( # pylint: disable=name-too-long - ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], HybridComputeManagementClientConfiguration] -): - - async def _upgrade_extensions_initial( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, 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", self._config.api_version)) - 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(extension_upgrade_parameters, (IOBase, bytes)): - _content = extension_upgrade_parameters - else: - _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") - - _request = build_upgrade_extensions_request( - resource_group_name=resource_group_name, - machine_name=machine_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( # type: ignore # 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: _models.MachineExtensionUpgrade, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade - :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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a MachineExtensionUpgrade type or a IO[bytes] type. Required. - :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade 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", self._config.api_version)) - 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._upgrade_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_upgrade_parameters=extension_upgrade_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, **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 _setup_extensions_initial( - self, - resource_group_name: str, - machine_name: str, - extensions: Union[_models.SetupExtensionRequest, 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", self._config.api_version)) - 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(extensions, (IOBase, bytes)): - _content = extensions - else: - _json = self._serialize.body(extensions, "SetupExtensionRequest") - - _request = build_setup_extensions_request( - resource_group_name=resource_group_name, - machine_name=machine_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( # type: ignore # 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: _models.SetupExtensionRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Required. - :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest - :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 SetupExtensionRequest or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Required. - :type extensions: 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 SetupExtensionRequest or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: Union[_models.SetupExtensionRequest, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Is either a - SetupExtensionRequest type or a IO[bytes] type. Required. - :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest or IO[bytes] - :return: An instance of AsyncLROPoller that returns either SetupExtensionRequest or the result - of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SetupExtensionRequest] = 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._setup_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extensions=extensions, - 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("SetupExtensionRequest", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.SetupExtensionRequest].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.SetupExtensionRequest]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py deleted file mode 100644 index 3679be38127a..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_license_profiles_operations.py +++ /dev/null @@ -1,737 +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, Dict, IO, Literal, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._license_profiles_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LicenseProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`license_profiles` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfile, 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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, "LicenseProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - parameters: _models.LicenseProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. - Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile - :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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. - 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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfile, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. Is - either a LicenseProfile type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LicenseProfile] = 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, - machine_name=machine_name, - parameters=parameters, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LicenseProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LicenseProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfileUpdate, 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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, "LicenseProfileUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - parameters: _models.LicenseProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate - :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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - machine_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. Is either a - LicenseProfileUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LicenseProfile] = 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, - machine_name=machine_name, - parameters=parameters, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.LicenseProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.LicenseProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: - """Retrieves information about the view of a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :return: LicenseProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile - :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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial(self, resource_group_name: str, machine_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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to delete a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, - machine_name=machine_name, - api_version=api_version, - license_profile_name=license_profile_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 - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **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, machine_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.LicenseProfile"]: - """The operation to get all license profiles of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine. Required. - :type machine_name: str - :return: An iterator like instance of either LicenseProfile or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicenseProfilesListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("LicenseProfilesListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py deleted file mode 100644 index f03eacfdd78c..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_licenses_operations.py +++ /dev/null @@ -1,914 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._licenses_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_update_request, - build_validate_license_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class LicensesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`licenses` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _validate_license_initial( - self, parameters: Union[_models.License, 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", self._config.api_version)) - 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, "License") - - _request = build_validate_license_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) - - _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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_validate_license( - self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License - :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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_validate_license( - self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. 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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_validate_license( - self, parameters: Union[_models.License, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. Is either a License - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License or IO[bytes] - :return: An instance of AsyncLROPoller that returns either License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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._validate_license_initial( - 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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _create_or_update_initial( - self, resource_group_name: str, license_name: str, parameters: Union[_models.License, 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", self._config.api_version)) - 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, "License") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - license_name=license_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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - license_name: str, - parameters: _models.License, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License - :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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - license_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. 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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO[bytes]], **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. Is either a License - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License or IO[bytes] - :return: An instance of AsyncLROPoller that returns either License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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, - license_name=license_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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - license_name: str, - parameters: Union[_models.LicenseUpdate, 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", self._config.api_version)) - 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, "LicenseUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - license_name=license_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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: _models.LicenseUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate - :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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. 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 License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: Union[_models.LicenseUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. Is either a - LicenseUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate or IO[bytes] - :return: An instance of AsyncLROPoller that returns either License or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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, - license_name=license_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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get(self, resource_group_name: str, license_name: str, **kwargs: Any) -> _models.License: - """Retrieves information about the view of a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :return: License or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.License - :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", self._config.api_version)) - cls: ClsType[_models.License] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - license_name=license_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("License", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial(self, resource_group_name: str, license_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - license_name=license_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, 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete(self, resource_group_name: str, license_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to delete a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - license_name=license_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, **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.License"]: - """The operation to get all licenses of a non-Azure machine. - - :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 License or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicensesListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("LicensesListResult", 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_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.License"]: - """The operation to get all licenses of a non-Azure machine. - - :return: An iterator like instance of either License or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicensesListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("LicensesListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_operations.py deleted file mode 100644 index 6fc78c168771..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_extensions_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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._machine_extensions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`machine_extensions` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, 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", self._config.api_version)) - 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(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension - :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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a MachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = 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, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_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("MachineExtension", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, 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", self._config.api_version)) - 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(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate - :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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a MachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = 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, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_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("MachineExtension", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.MachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, machine_name: str, extension_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, extension_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be deleted. Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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, **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( - self, resource_group_name: str, machine_name: str, extension_name: str, **kwargs: Any - ) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.MachineExtension - :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", self._config.api_version)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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("MachineExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineExtensionsListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_run_commands_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_run_commands_operations.py deleted file mode 100644 index 7bcf561d89d8..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machine_run_commands_operations.py +++ /dev/null @@ -1,552 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._machine_run_commands_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`machine_run_commands` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: Union[_models.MachineRunCommand, 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", self._config.api_version)) - 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(run_command_properties, (IOBase, bytes)): - _content = run_command_properties - else: - _json = self._serialize.body(run_command_properties, "MachineRunCommand") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - run_command_name: str, - run_command_properties: _models.MachineRunCommand, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Required. - :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand - :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 MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Required. - :type run_command_properties: 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 MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: Union[_models.MachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Is either a - MachineRunCommand type or a IO[bytes] type. Required. - :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineRunCommand] = 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, - machine_name=machine_name, - run_command_name=run_command_name, - run_command_properties=run_command_properties, - 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("MachineRunCommand", 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.MachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, machine_name: str, run_command_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, run_command_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """The operation to delete a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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( - self, resource_group_name: str, machine_name: str, run_command_name: str, **kwargs: Any - ) -> _models.MachineRunCommand: - """The operation to get a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :return: MachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.MachineRunCommand - :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", self._config.api_version)) - cls: ClsType[_models.MachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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("MachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.MachineRunCommand"]: - """The operation to get all the run commands of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either MachineRunCommand or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineRunCommandsListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineRunCommandsListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py deleted file mode 100644 index 7b649c2f9b38..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_machines_operations.py +++ /dev/null @@ -1,723 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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._machines_operations import ( - build_assess_patches_request, - build_delete_request, - build_get_request, - build_install_patches_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class MachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`machines` 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: HybridComputeManagementClientConfiguration = ( - 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") - - async def _delete_initial(self, resource_group_name: str, machine_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """The operation to delete a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_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, **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( - self, - resource_group_name: str, - machine_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.Machine: - """Retrieves information about the model view or the instance view of a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. "instanceView" Default value is - None. - :type expand: str or ~azure.mgmt.hybridcompute.models.InstanceViewTypes - :return: Machine or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Machine - :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", self._config.api_version)) - cls: ClsType[_models.Machine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - 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("Machine", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _assess_patches_initial(self, resource_group_name: str, 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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_assess_patches_request( - resource_group_name=resource_group_name, - name=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")) - - 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_assess_patches( - self, resource_group_name: str, name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.MachineAssessPatchesResult]: - """The operation to assess patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :return: An instance of AsyncLROPoller that returns either MachineAssessPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineAssessPatchesResult] = 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._assess_patches_initial( - resource_group_name=resource_group_name, - name=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): - deserialized = self._deserialize("MachineAssessPatchesResult", 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.MachineAssessPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _install_patches_initial( - self, - resource_group_name: str, - name: str, - install_patches_input: Union[_models.MachineInstallPatchesParameters, 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", self._config.api_version)) - 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(install_patches_input, (IOBase, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "MachineInstallPatchesParameters") - - _request = build_install_patches_request( - resource_group_name=resource_group_name, - name=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")) - - 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_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: _models.MachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters - :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 MachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: 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 MachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: Union[_models.MachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a MachineInstallPatchesParameters type or a IO[bytes] type. Required. - :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters - or IO[bytes] - :return: An instance of AsyncLROPoller that returns either MachineInstallPatchesResult or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineInstallPatchesResult] = 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._install_patches_initial( - resource_group_name=resource_group_name, - name=name, - install_patches_input=install_patches_input, - 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("MachineInstallPatchesResult", 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.MachineInstallPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.MachineInstallPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> AsyncItemPaged["_models.Machine"]: - """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the - response to get the next page of hybrid machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param expand: Expands referenced resources. Default value is None. - :type expand: str - :return: An iterator like instance of either Machine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Machine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineListResult] = 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, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineListResult", 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_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Machine"]: - """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the - response to get the next page of hybrid machines. - - :return: An iterator like instance of either Machine or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Machine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("MachineListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py deleted file mode 100644 index 0d4ecb8825ce..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_profile_operations.py +++ /dev/null @@ -1,110 +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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core import AsyncPipelineClient -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_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._network_profile_operations import build_get_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkProfileOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`network_profile` 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: HybridComputeManagementClientConfiguration = ( - 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, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: - """The operation to get network information of hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :return: NetworkProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile - :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", self._config.api_version)) - cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_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("NetworkProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_security_perimeter_configurations_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index 6283f43e6163..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,341 +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 typing import Any, AsyncIterator, Callable, Dict, Optional, TypeVar, Union, cast -import urllib.parse - -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._network_security_perimeter_configurations_operations import ( - build_get_by_private_link_scope_request, - build_list_by_private_link_scope_request, - build_reconcile_for_private_link_scope_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`network_security_perimeter_configurations` 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: HybridComputeManagementClientConfiguration = ( - 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_by_private_link_scope( - self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Gets the network security perimeter configuration for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the - Network Security Perimeter resource. Required. - :type perimeter_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration - :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", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: - """Lists the network security perimeter configurations for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfigurationListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", 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) - - async def _reconcile_for_private_link_scope_initial( # pylint: disable=name-too-long - self, resource_group_name: str, scope_name: str, perimeter_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reconcile_for_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_reconcile_for_private_link_scope( - self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any - ) -> AsyncLROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]: - """Forces the network security perimeter configuration to refresh for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the - Network Security Perimeter resource. Required. - :type perimeter_name: str - :return: An instance of AsyncLROPoller that returns either - NetworkSecurityPerimeterConfigurationReconcileResult or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationReconcileResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfigurationReconcileResult] = 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._reconcile_for_private_link_scope_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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): - deserialized = self._deserialize( - "NetworkSecurityPerimeterConfigurationReconcileResult", 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, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py index d72ff5ff0ca8..b26290f94cb7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_operations.py @@ -1,12 +1,15 @@ +# 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, Dict, Optional, TypeVar +from io import IOBase +import json +from typing import Any, AsyncIterator, Callable, IO, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import AsyncPipelineClient @@ -17,21 +20,96 @@ 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 ..._utils.utils import ClientMixinABC +from ...operations._operations import ( + build_extension_metadata_get_request, + build_extension_metadata_list_request, + build_extension_metadata_v2_get_request, + build_extension_metadata_v2_list_request, + build_extension_publisher_list_request, + build_extension_type_list_request, + build_gateways_create_or_update_request, + build_gateways_delete_request, + build_gateways_get_request, + build_gateways_list_by_resource_group_request, + build_gateways_list_by_subscription_request, + build_gateways_update_request, + build_hybrid_compute_management_setup_extensions_request, + build_hybrid_compute_management_upgrade_extensions_request, + build_license_profiles_create_or_update_request, + build_license_profiles_delete_request, + build_license_profiles_get_request, + build_license_profiles_list_request, + build_license_profiles_update_request, + build_licenses_create_or_update_request, + build_licenses_delete_request, + build_licenses_get_request, + build_licenses_list_by_resource_group_request, + build_licenses_list_by_subscription_request, + build_licenses_update_request, + build_licenses_validate_license_request, + build_machine_extensions_create_or_update_request, + build_machine_extensions_delete_request, + build_machine_extensions_get_request, + build_machine_extensions_list_request, + build_machine_extensions_update_request, + build_machine_run_commands_create_or_update_request, + build_machine_run_commands_delete_request, + build_machine_run_commands_get_request, + build_machine_run_commands_list_request, + build_machines_assess_patches_request, + build_machines_create_or_update_request, + build_machines_delete_request, + build_machines_get_request, + build_machines_install_patches_request, + build_machines_list_by_resource_group_request, + build_machines_list_by_subscription_request, + build_machines_update_request, + build_network_profile_get_request, + build_network_security_perimeter_configurations_get_by_private_link_scope_request, + build_network_security_perimeter_configurations_list_by_private_link_scope_request, + build_network_security_perimeter_configurations_reconcile_for_private_link_scope_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_by_private_link_scope_request, + build_private_link_resources_get_request, + build_private_link_resources_list_by_private_link_scope_request, + build_private_link_scopes_create_or_update_request, + build_private_link_scopes_delete_request, + build_private_link_scopes_get_request, + build_private_link_scopes_get_validation_details_for_machine_request, + build_private_link_scopes_get_validation_details_request, + build_private_link_scopes_list_by_resource_group_request, + build_private_link_scopes_list_request, + build_private_link_scopes_update_tags_request, + build_settings_get_request, + build_settings_patch_request, + build_settings_update_request, +) from .._configuration import HybridComputeManagementClientConfiguration T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] +List = list class Operations: @@ -44,8 +122,6 @@ class Operations: :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") @@ -59,16 +135,790 @@ def __init__(self, *args, **kwargs) -> None: def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationValue"]: """Gets a list of hybrid compute operations. - :return: An iterator like instance of either OperationValue or the result of cls(response) + :return: An iterator like instance of OperationValue :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.OperationValue] :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.OperationValue]] = 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), + headers=_headers, + 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.OperationValue], + 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 LicensesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`licenses` 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: HybridComputeManagementClientConfiguration = ( + 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, license_name: str, **kwargs: Any) -> _models.License: + """Retrieves information about the view of a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :return: License. The License is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.License + :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.License] = kwargs.pop("cls", None) + + _request = build_licenses_get_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.License, 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, + license_name: str, + parameters: Union[_models.License, 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_licenses_create_or_update_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + 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, + license_name: str, + parameters: _models.License, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.License, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Is one of the following + types: License, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.LicenseUpdate, 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_licenses_update_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + 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, + license_name: str, + parameters: _models.LicenseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.LicenseUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Is one of the following + types: LicenseUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, license_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_licenses_delete_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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, 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 == 200: + 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 _decompress else response.iter_raw() + + 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, license_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_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, + license_name=license_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.License"]: + """The operation to get all licenses of a non-Azure machine. + + :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 License + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] + :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", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.License]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -81,12 +931,19 @@ def list(self, **kwargs: Any) -> AsyncItemPaged["_models.OperationValue"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_licenses_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: # make call to next link with the client's api-version @@ -99,18 +956,29 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + 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.License], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return 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) @@ -123,9 +991,8235 @@ 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(_models.ErrorResponse, pipeline_response) + 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 + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :return: An iterator like instance of License + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.License]] = 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_licenses_list_by_subscription_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), + headers=_headers, + 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.License], + 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 _validate_license_initial( + self, parameters: Union[_models.License, 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_licenses_validate_license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_validate_license( + self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_license( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_validate_license( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_validate_license( + self, parameters: Union[_models.License, JSON, IO[bytes]], **kwargs: Any + ) -> AsyncLROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. Is one of the following types: License, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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._validate_license_initial( + 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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class MachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`machines` 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: HybridComputeManagementClientConfiguration = ( + 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, + machine_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.Machine: + """Retrieves information about the model view or the instance view of a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. "instanceView" Default value + is None. + :paramtype expand: str or ~azure.mgmt.hybridcompute.models.InstanceViewTypes + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = kwargs.pop("cls", None) + + _request = build_machines_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.Machine, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Machine + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: JSON + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: IO[bytes] + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.Machine, JSON, IO[bytes]], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Is one of the + following types: Machine, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Machine or JSON or IO[bytes] + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = 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_machines_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.MachineUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.MachineUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. 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: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. 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: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.MachineUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. Is one of the + following types: MachineUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.MachineUpdate or JSON or IO[bytes] + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = 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_machines_update_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial(self, resource_group_name: str, machine_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_machines_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, machine_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_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, + machine_name=machine_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, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.Machine"]: + """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the + response to get the next page of hybrid machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :return: An iterator like instance of Machine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Machine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Machine]] = 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_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.Machine], + 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 + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Machine"]: + """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the + response to get the next page of hybrid machines. + + :return: An iterator like instance of Machine + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Machine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Machine]] = 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_machines_list_by_subscription_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), + headers=_headers, + 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.Machine], + 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 _assess_patches_initial(self, resource_group_name: str, 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_machines_assess_patches_request( + resource_group_name=resource_group_name, + name=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) + + _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 = _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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_assess_patches( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.MachineAssessPatchesResult]: + """The operation to assess patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :return: An instance of AsyncLROPoller that returns MachineAssessPatchesResult. The + MachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MachineAssessPatchesResult] = 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._assess_patches_initial( + resource_group_name=resource_group_name, + name=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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MachineAssessPatchesResult, 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.MachineAssessPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _install_patches_initial( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, 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(install_patches_input, (IOBase, bytes)): + _content = install_patches_input + else: + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machines_install_patches_request( + resource_group_name=resource_group_name, + name=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) + + _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 = _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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: _models.MachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + :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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: MachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :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.MachineInstallPatchesResult] = 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._install_patches_initial( + resource_group_name=resource_group_name, + name=name, + install_patches_input=install_patches_input, + 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.MachineInstallPatchesResult, 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.MachineInstallPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class LicenseProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`license_profiles` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: + """Retrieves information about the view of a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: LicenseProfile. The LicenseProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + _request = build_license_profiles_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LicenseProfile, 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, + machine_name: str, + parameters: Union[_models.LicenseProfile, 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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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_license_profiles_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + machine_name: str, + parameters: _models.LicenseProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + 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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + 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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. Is + one of the following types: LicenseProfile, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + license_profile_name=license_profile_name, + 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.LicenseProfile, 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.LicenseProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LicenseProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, 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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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_license_profiles_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, + machine_name: str, + parameters: _models.LicenseProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate + :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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Is one of the + following types: LicenseProfileUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns LicenseProfile. The LicenseProfile is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + license_profile_name=license_profile_name, + 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.LicenseProfile, 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.LicenseProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.LicenseProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial(self, resource_group_name: str, machine_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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_license_profiles_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, machine_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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, + machine_name=machine_name, + license_profile_name=license_profile_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, machine_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.LicenseProfile"]: + """The operation to get all license profiles of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: An iterator like instance of LicenseProfile + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LicenseProfile]] = 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_license_profiles_list_request( + resource_group_name=resource_group_name, + machine_name=machine_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), + headers=_headers, + 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.LicenseProfile], + 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 MachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`machine_extensions` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, extension_name: str, **kwargs: Any + ) -> _models.MachineExtension: + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :return: MachineExtension. The MachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.MachineExtension + :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.MachineExtension] = kwargs.pop("cls", None) + + _request = build_machine_extensions_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MachineExtension, 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, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, 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(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_extensions_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _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 _decompress else response.iter_raw() + + 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, + machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension + :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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is + one of the following types: MachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :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.MachineExtension] = 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, + machine_name=machine_name, + extension_name=extension_name, + extension_parameters=extension_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.MachineExtension, 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.MachineExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MachineExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, 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(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_extensions_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, + machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate + :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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is + one of the following types: MachineExtensionUpdate, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :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.MachineExtension] = 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, + machine_name=machine_name, + extension_name=extension_name, + extension_parameters=extension_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.MachineExtension, 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.MachineExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MachineExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, machine_name: str, extension_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_machine_extensions_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, machine_name: str, extension_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_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, + machine_name=machine_name, + extension_name=extension_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, machine_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.MachineExtension"]: + """The operation to get all extensions of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of MachineExtension + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MachineExtension]] = 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_machine_extensions_list_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.MachineExtension], + 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 MachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`machine_run_commands` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, run_command_name: str, **kwargs: Any + ) -> _models.MachineRunCommand: + """The operation to get a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :return: MachineRunCommand. The MachineRunCommand is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.MachineRunCommand + :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.MachineRunCommand] = kwargs.pop("cls", None) + + _request = build_machine_run_commands_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MachineRunCommand, 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, + machine_name: str, + run_command_name: str, + run_command_properties: Union[_models.MachineRunCommand, 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(run_command_properties, (IOBase, bytes)): + _content = run_command_properties + else: + _content = json.dumps(run_command_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_run_commands_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + machine_name: str, + run_command_name: str, + run_command_properties: _models.MachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand + :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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: 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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: 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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: Union[_models.MachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Is one of the + following types: MachineRunCommand, JSON, IO[bytes] Required. + :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :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.MachineRunCommand] = 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, + machine_name=machine_name, + run_command_name=run_command_name, + run_command_properties=run_command_properties, + 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.MachineRunCommand, 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.MachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.MachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, machine_name: str, run_command_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_machine_run_commands_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, machine_name: str, run_command_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to delete a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_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, + machine_name=machine_name, + run_command_name=run_command_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, machine_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> AsyncItemPaged["_models.MachineRunCommand"]: + """The operation to get all the run commands of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of MachineRunCommand + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MachineRunCommand]] = 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_machine_run_commands_list_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.MachineRunCommand], + 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 GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`gateways` 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: HybridComputeManagementClientConfiguration = ( + 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, gateway_name: str, **kwargs: Any) -> _models.Gateway: + """Retrieves information about the view of a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :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.Gateway] = kwargs.pop("cls", None) + + _request = build_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Gateway, 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, + gateway_name: str, + parameters: Union[_models.Gateway, 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_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + gateway_name: str, + parameters: _models.Gateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Gateway + :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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.Gateway, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. Is one of the following + types: Gateway, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Gateway or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :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.Gateway] = 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, + gateway_name=gateway_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Gateway, 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.Gateway].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.Gateway]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: _models.GatewayUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.GatewayUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. Is one of the following + types: GatewayUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate or JSON or IO[bytes] + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :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.Gateway] = 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_gateways_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Gateway, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial(self, resource_group_name: str, gateway_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_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, gateway_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """The operation to delete a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_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, + gateway_name=gateway_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.Gateway"]: + """The operation to get all gateways of a non-Azure machine. + + :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 Gateway + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gateway]] = 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_gateways_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), + headers=_headers, + 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.Gateway], + 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 + def list_by_subscription(self, **kwargs: Any) -> AsyncItemPaged["_models.Gateway"]: + """The operation to get all gateways of a non-Azure machine. + + :return: An iterator like instance of Gateway + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gateway]] = 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_gateways_list_by_subscription_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), + headers=_headers, + 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.Gateway], + 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 PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`private_link_resources` 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: HybridComputeManagementClientConfiguration = ( + 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, scope_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.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_private_link_resources_get_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.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_private_link_resources_list_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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 PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'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: HybridComputeManagementClientConfiguration = ( + 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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.hybridcompute.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, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + 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, + scope_name: str, + private_endpoint_connection_name: str, + parameters: 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _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 = _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 _decompress else response.iter_raw() + + 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, + scope_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.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, + scope_name=scope_name, + private_endpoint_connection_name=private_endpoint_connection_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): + 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, scope_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, + scope_name=scope_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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, + scope_name=scope_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_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: + """Gets all private endpoint connections on a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.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_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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 NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`network_security_perimeter_configurations` 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: HybridComputeManagementClientConfiguration = ( + 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_by_private_link_scope( + self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the network security perimeter configuration for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the + Network Security Perimeter resource. Required. + :type perimeter_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration + :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> AsyncItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: + """Lists the network security perimeter configurations for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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.NetworkSecurityPerimeterConfiguration], + 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 _reconcile_for_private_link_scope_initial( # pylint: disable=name-too-long + self, resource_group_name: str, scope_name: str, perimeter_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_network_security_perimeter_configurations_reconcile_for_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_reconcile_for_private_link_scope( + self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any + ) -> AsyncLROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]: + """Forces the network security perimeter configuration to refresh for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the + Network Security Perimeter resource. Required. + :type perimeter_name: str + :return: An instance of AsyncLROPoller that returns + NetworkSecurityPerimeterConfigurationReconcileResult. The + NetworkSecurityPerimeterConfigurationReconcileResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationReconcileResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationReconcileResult] = 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._reconcile_for_private_link_scope_initial( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfigurationReconcileResult, 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.NetworkSecurityPerimeterConfigurationReconcileResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class NetworkProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`network_profile` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: + """The operation to get network information of hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: NetworkProfile. The NetworkProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile + :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.NetworkProfile] = kwargs.pop("cls", None) + + _request = build_network_profile_get_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateLinkScopesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`private_link_scopes` 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: HybridComputeManagementClientConfiguration = ( + 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_validation_details_for_machine( + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> _models.PrivateLinkScopeValidationDetails: + """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: PrivateLinkScopeValidationDetails. The PrivateLinkScopeValidationDetails is compatible + with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails + :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.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_validation_details_for_machine_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkScopeValidationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Returns a Azure Arc PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: _models.HybridComputePrivateLinkScope, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: Union[_models.HybridComputePrivateLinkScope, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. Is one of the following types: + HybridComputePrivateLinkScope, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or JSON or + IO[bytes] + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = 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_private_link_scopes_create_or_update_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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, 201]: + 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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: Union[_models.TagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Is one of the following types: TagsResource, JSON, IO[bytes] Required. + :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or JSON or + IO[bytes] + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_link_scope_tags, (IOBase, bytes)): + _content = private_link_scope_tags + else: + _content = json.dumps(private_link_scope_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_link_scopes_update_tags_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial(self, resource_group_name: str, scope_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_link_scopes_delete_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, scope_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Deletes a Azure Arc PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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, + scope_name=scope_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.HybridComputePrivateLinkScope"]: + """Gets a list of Azure Arc PrivateLinkScopes within a 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 HybridComputePrivateLinkScope + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridComputePrivateLinkScope]] = 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_link_scopes_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), + headers=_headers, + 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.HybridComputePrivateLinkScope], + 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 + def list(self, **kwargs: Any) -> AsyncItemPaged["_models.HybridComputePrivateLinkScope"]: + """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. + + :return: An iterator like instance of HybridComputePrivateLinkScope + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridComputePrivateLinkScope]] = 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_link_scopes_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), + headers=_headers, + 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.HybridComputePrivateLinkScope], + 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_validation_details( + self, location: str, private_link_scope_id: str, **kwargs: Any + ) -> _models.PrivateLinkScopeValidationDetails: + """Returns a Azure Arc PrivateLinkScope's validation details. + + :param location: The name of the Azure region. Required. + :type location: str + :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. + Required. + :type private_link_scope_id: str + :return: PrivateLinkScopeValidationDetails. The PrivateLinkScopeValidationDetails is compatible + with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails + :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.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_validation_details_request( + location=location, + private_link_scope_id=private_link_scope_id, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkScopeValidationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExtensionMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`extension_metadata` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValue: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :return: ExtensionValue. The ExtensionValue is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue + :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.ExtensionValue] = kwargs.pop("cls", None) + + _request = build_extension_metadata_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExtensionValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ExtensionValue"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :return: An iterator like instance of ExtensionValue + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionValue]] = 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_extension_metadata_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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), + headers=_headers, + 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.ExtensionValue], + 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 ExtensionMetadataV2Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`extension_metadata_v2` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValueV2: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :return: ExtensionValueV2. The ExtensionValueV2 is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValueV2 + :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.ExtensionValueV2] = kwargs.pop("cls", None) + + _request = build_extension_metadata_v2_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExtensionValueV2, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> AsyncItemPaged["_models.ExtensionValueV2"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :return: An iterator like instance of ExtensionValueV2 + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValueV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionValueV2]] = 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_extension_metadata_v2_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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), + headers=_headers, + 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.ExtensionValueV2], + 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 SettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`settings` 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: HybridComputeManagementClientConfiguration = ( + 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, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> _models.Settings: + """Returns the base Settings for the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = kwargs.pop("cls", None) + + _request = build_settings_get_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: _models.Settings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: Union[_models.Settings, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Is one of the following types: Settings, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings or JSON or IO[bytes] + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = 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_settings_update_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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, 201]: + 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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: _models.Settings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: Union[_models.Settings, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Is one of the following types: Settings, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings or JSON or IO[bytes] + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = 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_settings_patch_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExtensionTypeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`extension_type` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, **kwargs: Any) -> AsyncItemPaged["_models.ExtensionType"]: + """Gets all Extension types based on location and publisher. + + :param location: The location name. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :return: An iterator like instance of ExtensionType + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionType]] = 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_extension_type_list_request( + location=location, + publisher=publisher, + 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), + headers=_headers, + 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.ExtensionType], + 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 ExtensionPublisherOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s + :attr:`extension_publisher` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, **kwargs: Any) -> AsyncItemPaged["_models.ExtensionPublisher"]: + """Gets all Extension publishers based on the location. + + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of ExtensionPublisher + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.ExtensionPublisher] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionPublisher]] = 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_extension_publisher_list_request( + location=location, + 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), + headers=_headers, + 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.ExtensionPublisher], + 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 _HybridComputeManagementClientOperationsMixin( + ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], HybridComputeManagementClientConfiguration] +): + + async def _upgrade_extensions_initial( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, 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(extension_upgrade_parameters, (IOBase, bytes)): + _content = extension_upgrade_parameters + else: + _content = json.dumps(extension_upgrade_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_compute_management_upgrade_extensions_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: _models.MachineExtensionUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade + :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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Is one of the following types: MachineExtensionUpgrade, JSON, IO[bytes] Required. + :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade 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._upgrade_extensions_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_upgrade_parameters=extension_upgrade_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 + + async def _setup_extensions_initial( + self, + resource_group_name: str, + machine_name: str, + extensions: Union[_models.SetupExtensionRequest, 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(extensions, (IOBase, bytes)): + _content = extensions + else: + _content = json.dumps(extensions, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_compute_management_setup_extensions_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: _models.SetupExtensionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest + :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 SetupExtensionRequest. The + SetupExtensionRequest is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: 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 SetupExtensionRequest. The + SetupExtensionRequest is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: 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 SetupExtensionRequest. The + SetupExtensionRequest is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: Union[_models.SetupExtensionRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Is one of the + following types: SetupExtensionRequest, JSON, IO[bytes] Required. + :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns SetupExtensionRequest. The + SetupExtensionRequest is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :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.SetupExtensionRequest] = 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._setup_extensions_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + extensions=extensions, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.SetupExtensionRequest, 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.SetupExtensionRequest].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.SetupExtensionRequest]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_patch.py index f7dd32510333..ea765788358a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_patch.py @@ -1,14 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 09cb911ab67b..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,539 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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_by_private_link_scope_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'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: HybridComputeManagementClientConfiguration = ( - 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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.hybridcompute.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", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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, - scope_name: str, - private_endpoint_connection_name: str, - parameters: 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", self._config.api_version)) - 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, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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, 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: 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 PrivateEndpointConnection or the - result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.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", self._config.api_version)) - 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, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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): - 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, **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, scope_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_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, **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_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.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", self._config.api_version)) - 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_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py deleted file mode 100644 index e810222ddcc8..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,203 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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._private_link_resources_operations import build_get_request, build_list_by_private_link_scope_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`private_link_resources` 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: HybridComputeManagementClientConfiguration = ( - 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_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> AsyncItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.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", self._config.api_version)) - 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_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.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( - self, resource_group_name: str, scope_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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 diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py deleted file mode 100644 index fa20ad9d6152..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,789 +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, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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_link_scopes_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_get_validation_details_for_machine_request, - build_get_validation_details_request, - build_list_by_resource_group_request, - build_list_request, - build_update_tags_request, -) -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class PrivateLinkScopesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`private_link_scopes` 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: HybridComputeManagementClientConfiguration = ( - 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) -> AsyncItemPaged["_models.HybridComputePrivateLinkScope"]: - """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - - :return: An iterator like instance of either HybridComputePrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("HybridComputePrivateLinkScopeListResult", 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.HybridComputePrivateLinkScope"]: - """Gets a list of Azure Arc PrivateLinkScopes within a 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 HybridComputePrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("HybridComputePrivateLinkScopeListResult", 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) - - async def _delete_initial(self, resource_group_name: str, scope_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", self._config.api_version)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, scope_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_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, **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( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Returns a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: _models.HybridComputePrivateLinkScope, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: Union[_models.HybridComputePrivateLinkScope, IO[bytes]], - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Is either a HybridComputePrivateLinkScope type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or IO[bytes] - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = 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, "HybridComputePrivateLinkScope") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: 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: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or IO[bytes] - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_link_scope_tags, (IOBase, bytes)): - _content = private_link_scope_tags - else: - _json = self._serialize.body(private_link_scope_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_validation_details( - self, location: str, private_link_scope_id: str, **kwargs: Any - ) -> _models.PrivateLinkScopeValidationDetails: - """Returns a Azure Arc PrivateLinkScope's validation details. - - :param location: The location of the target resource. Required. - :type location: str - :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. - Required. - :type private_link_scope_id: str - :return: PrivateLinkScopeValidationDetails or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails - :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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) - - _request = build_get_validation_details_request( - location=location, - private_link_scope_id=private_link_scope_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("PrivateLinkScopeValidationDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_validation_details_for_machine( - self, resource_group_name: str, machine_name: str, **kwargs: Any - ) -> _models.PrivateLinkScopeValidationDetails: - """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the target machine to get the private link scope validation - details for. Required. - :type machine_name: str - :return: PrivateLinkScopeValidationDetails or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails - :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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) - - _request = build_get_validation_details_for_machine_request( - resource_group_name=resource_group_name, - machine_name=machine_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("PrivateLinkScopeValidationDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_settings_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_settings_operations.py deleted file mode 100644 index 5afec087ad19..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/aio/operations/_settings_operations.py +++ /dev/null @@ -1,448 +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, Dict, IO, Optional, TypeVar, Union, overload - -from azure.core import AsyncPipelineClient -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_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._settings_operations import build_get_request, build_patch_request, build_update_request -from .._configuration import HybridComputeManagementClientConfiguration - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class SettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.aio.HybridComputeManagementClient`'s - :attr:`settings` 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: HybridComputeManagementClientConfiguration = ( - 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, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - **kwargs: Any - ) -> _models.Settings: - """Returns the base Settings for the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - cls: ClsType[_models.Settings] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", 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, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: _models.Settings, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. 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: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: Union[_models.Settings, IO[bytes]], - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Is either a Settings type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings or IO[bytes] - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Settings] = 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, "Settings") - - _request = build_update_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: _models.Settings, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. 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: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: Union[_models.Settings, IO[bytes]], - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Is either a Settings type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings or IO[bytes] - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Settings] = 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, "Settings") - - _request = build_patch_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py index 185aa4150a84..9788734731e4 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/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,12 +13,11 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AccessRule, + AccessRuleProperties, AgentConfiguration, AgentUpgrade, - AgentVersion, - AgentVersionsList, AvailablePatchCountByClassification, CloudMetadata, ConfigurationExtension, @@ -28,44 +27,44 @@ ErrorDetail, ErrorResponse, EsuKey, + EsuProfileUpdateProperties, ExtensionPublisher, - ExtensionPublisherListResult, ExtensionTargetProperties, ExtensionType, - ExtensionTypeListResult, ExtensionValue, - ExtensionValueListResult, - ExtensionValueListResultV2, ExtensionValueProperties, ExtensionValueV2, ExtensionValueV2Properties, ExtensionsResourceStatus, FirmwareProfile, Gateway, + GatewayProperties, GatewayUpdate, - GatewaysListResult, + GatewayUpdateProperties, HardwareProfile, HybridComputePrivateLinkScope, - HybridComputePrivateLinkScopeListResult, HybridComputePrivateLinkScopeProperties, - HybridIdentityMetadata, - HybridIdentityMetadataList, Identity, IpAddress, - KeyDetails, - KeyProperties, License, LicenseDetails, LicenseProfile, LicenseProfileArmEsuProperties, LicenseProfileArmEsuPropertiesWithoutAssignedLicense, + LicenseProfileArmProductProfileProperties, LicenseProfileMachineInstanceView, LicenseProfileMachineInstanceViewEsuProperties, + LicenseProfileMachineInstanceViewSoftwareAssurance, + LicenseProfileProperties, + LicenseProfilePropertiesSoftwareAssurance, LicenseProfileStorageModelEsuProperties, LicenseProfileUpdate, - LicenseProfilesListResult, + LicenseProfileUpdateProperties, + LicenseProfileUpdatePropertiesSoftwareAssurance, + LicenseProperties, LicenseUpdate, - LicensesListResult, + LicenseUpdateProperties, + LicenseUpdatePropertiesLicenseDetails, LinuxParameters, LocationData, Machine, @@ -75,58 +74,57 @@ MachineExtensionInstanceViewStatus, MachineExtensionProperties, MachineExtensionUpdate, + MachineExtensionUpdateProperties, MachineExtensionUpgrade, - MachineExtensionsListResult, MachineInstallPatchesParameters, MachineInstallPatchesResult, - MachineListResult, + MachineProperties, MachineRunCommand, MachineRunCommandInstanceView, + MachineRunCommandProperties, MachineRunCommandScriptSource, - MachineRunCommandUpdate, - MachineRunCommandsListResult, MachineUpdate, - NetworkConfiguration, + MachineUpdateProperties, NetworkInterface, NetworkProfile, NetworkSecurityPerimeter, NetworkSecurityPerimeterConfiguration, - NetworkSecurityPerimeterConfigurationListResult, + NetworkSecurityPerimeterConfigurationProperties, NetworkSecurityPerimeterConfigurationReconcileResult, NetworkSecurityPerimeterProfile, OSProfile, OSProfileLinuxConfiguration, OSProfileWindowsConfiguration, - OperationListResult, OperationValue, OperationValueDisplay, + PatchSettings, PatchSettingsStatus, PrivateEndpointConnection, PrivateEndpointConnectionDataModel, - PrivateEndpointConnectionListResult, PrivateEndpointConnectionProperties, PrivateEndpointProperty, PrivateLinkResource, - PrivateLinkResourceListResult, PrivateLinkResourceProperties, PrivateLinkScopeValidationDetails, - PrivateLinkScopesResource, PrivateLinkServiceConnectionStateProperty, Processor, ProductFeature, ProductFeatureUpdate, + ProductProfileUpdateProperties, ProvisioningIssue, + ProvisioningIssueProperties, ProxyResource, - ProxyResourceAutoGenerated, Resource, ResourceAssociation, - ResourceAutoGenerated, ResourceUpdate, RunCommandInputParameter, RunCommandManagedIdentity, + ServiceExtension, ServiceStatus, ServiceStatuses, Settings, + SettingsGatewayProperties, + SettingsProperties, SetupExtensionRequest, StorageProfile, Subnet, @@ -137,7 +135,7 @@ WindowsParameters, ) -from ._hybrid_compute_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore AccessMode, AccessRuleDirection, AgentConfigurationMode, @@ -174,6 +172,8 @@ ProvisioningIssueType, ProvisioningState, PublicNetworkAccessType, + ResourceIdentityType, + ServiceExtensionPublicNetworkAccess, StatusLevelTypes, StatusTypes, VMGuestPatchClassificationLinux, @@ -187,10 +187,9 @@ __all__ = [ "AccessRule", + "AccessRuleProperties", "AgentConfiguration", "AgentUpgrade", - "AgentVersion", - "AgentVersionsList", "AvailablePatchCountByClassification", "CloudMetadata", "ConfigurationExtension", @@ -200,44 +199,44 @@ "ErrorDetail", "ErrorResponse", "EsuKey", + "EsuProfileUpdateProperties", "ExtensionPublisher", - "ExtensionPublisherListResult", "ExtensionTargetProperties", "ExtensionType", - "ExtensionTypeListResult", "ExtensionValue", - "ExtensionValueListResult", - "ExtensionValueListResultV2", "ExtensionValueProperties", "ExtensionValueV2", "ExtensionValueV2Properties", "ExtensionsResourceStatus", "FirmwareProfile", "Gateway", + "GatewayProperties", "GatewayUpdate", - "GatewaysListResult", + "GatewayUpdateProperties", "HardwareProfile", "HybridComputePrivateLinkScope", - "HybridComputePrivateLinkScopeListResult", "HybridComputePrivateLinkScopeProperties", - "HybridIdentityMetadata", - "HybridIdentityMetadataList", "Identity", "IpAddress", - "KeyDetails", - "KeyProperties", "License", "LicenseDetails", "LicenseProfile", "LicenseProfileArmEsuProperties", "LicenseProfileArmEsuPropertiesWithoutAssignedLicense", + "LicenseProfileArmProductProfileProperties", "LicenseProfileMachineInstanceView", "LicenseProfileMachineInstanceViewEsuProperties", + "LicenseProfileMachineInstanceViewSoftwareAssurance", + "LicenseProfileProperties", + "LicenseProfilePropertiesSoftwareAssurance", "LicenseProfileStorageModelEsuProperties", "LicenseProfileUpdate", - "LicenseProfilesListResult", + "LicenseProfileUpdateProperties", + "LicenseProfileUpdatePropertiesSoftwareAssurance", + "LicenseProperties", "LicenseUpdate", - "LicensesListResult", + "LicenseUpdateProperties", + "LicenseUpdatePropertiesLicenseDetails", "LinuxParameters", "LocationData", "Machine", @@ -247,58 +246,57 @@ "MachineExtensionInstanceViewStatus", "MachineExtensionProperties", "MachineExtensionUpdate", + "MachineExtensionUpdateProperties", "MachineExtensionUpgrade", - "MachineExtensionsListResult", "MachineInstallPatchesParameters", "MachineInstallPatchesResult", - "MachineListResult", + "MachineProperties", "MachineRunCommand", "MachineRunCommandInstanceView", + "MachineRunCommandProperties", "MachineRunCommandScriptSource", - "MachineRunCommandUpdate", - "MachineRunCommandsListResult", "MachineUpdate", - "NetworkConfiguration", + "MachineUpdateProperties", "NetworkInterface", "NetworkProfile", "NetworkSecurityPerimeter", "NetworkSecurityPerimeterConfiguration", - "NetworkSecurityPerimeterConfigurationListResult", + "NetworkSecurityPerimeterConfigurationProperties", "NetworkSecurityPerimeterConfigurationReconcileResult", "NetworkSecurityPerimeterProfile", "OSProfile", "OSProfileLinuxConfiguration", "OSProfileWindowsConfiguration", - "OperationListResult", "OperationValue", "OperationValueDisplay", + "PatchSettings", "PatchSettingsStatus", "PrivateEndpointConnection", "PrivateEndpointConnectionDataModel", - "PrivateEndpointConnectionListResult", "PrivateEndpointConnectionProperties", "PrivateEndpointProperty", "PrivateLinkResource", - "PrivateLinkResourceListResult", "PrivateLinkResourceProperties", "PrivateLinkScopeValidationDetails", - "PrivateLinkScopesResource", "PrivateLinkServiceConnectionStateProperty", "Processor", "ProductFeature", "ProductFeatureUpdate", + "ProductProfileUpdateProperties", "ProvisioningIssue", + "ProvisioningIssueProperties", "ProxyResource", - "ProxyResourceAutoGenerated", "Resource", "ResourceAssociation", - "ResourceAutoGenerated", "ResourceUpdate", "RunCommandInputParameter", "RunCommandManagedIdentity", + "ServiceExtension", "ServiceStatus", "ServiceStatuses", "Settings", + "SettingsGatewayProperties", + "SettingsProperties", "SetupExtensionRequest", "StorageProfile", "Subnet", @@ -343,6 +341,8 @@ "ProvisioningIssueType", "ProvisioningState", "PublicNetworkAccessType", + "ResourceIdentityType", + "ServiceExtensionPublicNetworkAccess", "StatusLevelTypes", "StatusTypes", "VMGuestPatchClassificationLinux", diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_enums.py similarity index 74% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_enums.py index 33a7347ecf54..f36293c103e8 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_hybrid_compute_management_client_enums.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/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. # -------------------------------------------------------------------------- @@ -29,7 +29,7 @@ class AccessRuleDirection(str, Enum, metaclass=CaseInsensitiveEnumMeta): INBOUND = "Inbound" """Traffic originates outside of network.""" OUTBOUND = "Outbound" - """Traffic originates inside the network""" + """Traffic originates inside the network.""" class AgentConfigurationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -38,214 +38,293 @@ class AgentConfigurationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ FULL = "full" + """full.""" MONITOR = "monitor" + """monitor.""" class ArcKindEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc.""" AVS = "AVS" + """AVS.""" HCI = "HCI" + """HCI.""" SCVMM = "SCVMM" + """SCVMM.""" V_MWARE = "VMware" + """VMware.""" EPS = "EPS" + """EPS.""" GCP = "GCP" + """GCP.""" AWS = "AWS" + """AWS.""" class AssessmentModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the assessment mode.""" IMAGE_DEFAULT = "ImageDefault" + """ImageDefault.""" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + """AutomaticByPlatform.""" 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 EsuEligibility(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The ESU eligibility.""" ELIGIBLE = "Eligible" + """Eligible.""" INELIGIBLE = "Ineligible" + """Ineligible.""" UNKNOWN = "Unknown" + """Unknown.""" class EsuKeyState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The ESU key state.""" INACTIVE = "Inactive" + """Inactive.""" ACTIVE = "Active" + """Active.""" class EsuServerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The server types for Esu.""" STANDARD = "Standard" + """Standard.""" DATACENTER = "Datacenter" + """Datacenter.""" class ExecutionState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Script execution status.""" UNKNOWN = "Unknown" + """Unknown.""" PENDING = "Pending" + """Pending.""" RUNNING = "Running" + """Running.""" FAILED = "Failed" + """Failed.""" SUCCEEDED = "Succeeded" + """Succeeded.""" TIMED_OUT = "TimedOut" + """TimedOut.""" CANCELED = "Canceled" + """Canceled.""" class ExtensionsStatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The level code.""" INFO = "Info" + """Info.""" WARNING = "Warning" + """Warning.""" ERROR = "Error" + """Error.""" class GatewayType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the Gateway resource.""" PUBLIC = "Public" + """Public.""" class HotpatchEnablementStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Status of hotpatch enablement or disablement.""" UNKNOWN = "Unknown" + """Unknown.""" PENDING_EVALUATION = "PendingEvaluation" + """PendingEvaluation.""" DISABLED = "Disabled" + """Disabled.""" ACTION_REQUIRED = "ActionRequired" + """ActionRequired.""" ENABLED = "Enabled" + """Enabled.""" class IdentityKeyStore(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the identity key store a machine is using.""" TPM = "TPM" + """TPM.""" DEFAULT = "Default" + """Default.""" class InstanceViewTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """InstanceViewTypes.""" + """Type of InstanceViewTypes.""" INSTANCE_VIEW = "instanceView" + """instanceView.""" class LastAttemptStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the status of Agent Upgrade.""" SUCCESS = "Success" + """Success.""" FAILED = "Failed" + """Failed.""" class LicenseAssignmentState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the license assignment state (Assigned or NotAssigned).""" ASSIGNED = "Assigned" + """Assigned.""" NOT_ASSIGNED = "NotAssigned" + """NotAssigned.""" class LicenseCoreType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the license core type (pCore or vCore).""" P_CORE = "pCore" + """pCore.""" V_CORE = "vCore" + """vCore.""" class LicenseEdition(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the edition of the license. The values are either Standard or Datacenter.""" STANDARD = "Standard" + """Standard.""" DATACENTER = "Datacenter" + """Datacenter.""" class LicenseProfileProductType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The product type of the license.""" WINDOWS_SERVER = "WindowsServer" + """WindowsServer.""" WINDOWS_IO_T_ENTERPRISE = "WindowsIoTEnterprise" + """WindowsIoTEnterprise.""" class LicenseProfileSubscriptionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Subscription status of the OS or Product feature.""" UNKNOWN = "Unknown" + """Unknown.""" ENABLING = "Enabling" + """Enabling.""" ENABLED = "Enabled" + """Enabled.""" DISABLED = "Disabled" + """Disabled.""" DISABLING = "Disabling" + """Disabling.""" FAILED = "Failed" + """Failed.""" class LicenseProfileSubscriptionStatusUpdate(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates the new subscription status of the OS or Product Features.""" ENABLE = "Enable" + """Enable.""" DISABLE = "Disable" + """Disable.""" class LicenseState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the state of the license.""" ACTIVATED = "Activated" + """Activated.""" DEACTIVATED = "Deactivated" + """Deactivated.""" class LicenseStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The license status.""" UNLICENSED = "Unlicensed" + """Unlicensed.""" LICENSED = "Licensed" + """Licensed.""" OOB_GRACE = "OOBGrace" + """OOBGrace.""" OOT_GRACE = "OOTGrace" + """OOTGrace.""" NON_GENUINE_GRACE = "NonGenuineGrace" + """NonGenuineGrace.""" NOTIFICATION = "Notification" + """Notification.""" EXTENDED_GRACE = "ExtendedGrace" + """ExtendedGrace.""" class LicenseTarget(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the license target server.""" WINDOWS_SERVER2012 = "Windows Server 2012" + """Windows Server 2012.""" WINDOWS_SERVER2012_R2 = "Windows Server 2012 R2" + """Windows Server 2012 R2.""" class LicenseType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of the license resource.""" ESU = "ESU" + """ESU.""" class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The operating system type of the machine.""" WINDOWS = "Windows" + """Windows.""" LINUX = "Linux" + """Linux.""" class PatchModeTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the patch mode.""" IMAGE_DEFAULT = "ImageDefault" + """ImageDefault.""" AUTOMATIC_BY_PLATFORM = "AutomaticByPlatform" + """AutomaticByPlatform.""" AUTOMATIC_BY_OS = "AutomaticByOS" + """AutomaticByOS.""" MANUAL = "Manual" + """Manual.""" class PatchOperationStartedBy(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates if operation was triggered by user or by platform.""" USER = "User" + """User.""" PLATFORM = "Platform" + """Platform.""" class PatchOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -255,29 +334,43 @@ class PatchOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """ UNKNOWN = "Unknown" + """Unknown.""" IN_PROGRESS = "InProgress" + """InProgress.""" FAILED = "Failed" + """Failed.""" SUCCEEDED = "Succeeded" + """Succeeded.""" COMPLETED_WITH_WARNINGS = "CompletedWithWarnings" + """CompletedWithWarnings.""" class PatchServiceUsed(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the patch service used for the operation.""" UNKNOWN = "Unknown" + """Unknown.""" WU = "WU" + """WU.""" WU_WSUS = "WU_WSUS" + """WU_WSUS.""" YUM = "YUM" + """YUM.""" APT = "APT" + """APT.""" ZYPPER = "Zypper" + """Zypper.""" class ProgramYear(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Describes the program year the volume license is for.""" YEAR1 = "Year 1" + """Year 1.""" YEAR2 = "Year 2" + """Year 2.""" YEAR3 = "Year 3" + """Year 3.""" class ProvisioningIssueSeverity(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -306,13 +399,21 @@ class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state, which only appears in the response.""" CREATING = "Creating" + """Creating.""" UPDATING = "Updating" + """Updating.""" DELETING = "Deleting" + """Deleting.""" SUCCEEDED = "Succeeded" + """Succeeded.""" FAILED = "Failed" + """Failed.""" ACCEPTED = "Accepted" + """Accepted.""" CANCELED = "Canceled" + """Canceled.""" DELETED = "Deleted" + """Deleted.""" class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -328,61 +429,108 @@ class PublicNetworkAccessType(str, Enum, metaclass=CaseInsensitiveEnumMeta): endpoints. The agents must use the private link.""" SECURED_BY_PERIMETER = "SecuredByPerimeter" """Azure Arc agent communication with Azure Arc services over public (internet) is enforced by - Network Security Perimeter (NSP)""" + Network Security Perimeter (NSP).""" + + +class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """ResourceIdentityType.""" + + SYSTEM_ASSIGNED = "SystemAssigned" + """SYSTEM_ASSIGNED.""" + + +class ServiceExtensionPublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The network access policy to determine if the specified Azure Arc Extension can use public + Azure Arc Extension service endpoints. + """ + + ENABLED = "Enabled" + """Allows Azure Arc Extension agents to communicate with Azure Arc services over both public + (internet) and private endpoints.""" + DISABLED = "Disabled" + """Does not allow Azure Arc Extension agents to communicate with Azure Arc services over public + (internet) endpoints. The agents must use the private link.""" class StatusLevelTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The level code.""" INFO = "Info" + """Info.""" WARNING = "Warning" + """Warning.""" ERROR = "Error" + """Error.""" class StatusTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The status of the hybrid machine agent.""" CONNECTED = "Connected" + """Connected.""" DISCONNECTED = "Disconnected" + """Disconnected.""" ERROR = "Error" + """Error.""" AWAITING_CONNECTION = "AwaitingConnection" + """AwaitingConnection.""" class VMGuestPatchClassificationLinux(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationLinux.""" + """Type of VMGuestPatchClassificationLinux.""" CRITICAL = "Critical" + """Critical.""" SECURITY = "Security" + """Security.""" OTHER = "Other" + """Other.""" class VMGuestPatchClassificationWindows(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """VMGuestPatchClassificationWindows.""" + """Type of VMGuestPatchClassificationWindows.""" CRITICAL = "Critical" + """Critical.""" SECURITY = "Security" + """Security.""" UPDATE_ROLL_UP = "UpdateRollUp" + """UpdateRollUp.""" FEATURE_PACK = "FeaturePack" + """FeaturePack.""" SERVICE_PACK = "ServicePack" + """ServicePack.""" DEFINITION = "Definition" + """Definition.""" TOOLS = "Tools" + """Tools.""" UPDATES = "Updates" + """Updates.""" class VMGuestPatchRebootSetting(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Defines when it is acceptable to reboot a VM during a software update operation.""" IF_REQUIRED = "IfRequired" + """IfRequired.""" NEVER = "Never" + """Never.""" ALWAYS = "Always" + """Always.""" class VMGuestPatchRebootStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reboot state of the VM following completion of the operation.""" UNKNOWN = "Unknown" + """Unknown.""" NOT_NEEDED = "NotNeeded" + """NotNeeded.""" REQUIRED = "Required" + """Required.""" STARTED = "Started" + """Started.""" FAILED = "Failed" + """Failed.""" COMPLETED = "Completed" + """Completed.""" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models.py new file mode 100644 index 000000000000..3db21ce1c85b --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models.py @@ -0,0 +1,5638 @@ +# 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 _types, models as _models + + +class AccessRule(_Model): + """Access rule. + + :ivar name: Name of the access rule. + :vartype name: str + :ivar properties: Access rule properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.AccessRuleProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the access rule.""" + properties: Optional["_models.AccessRuleProperties"] = rest_field(visibility=["read"]) + """Access rule properties.""" + + __flattened_items = ["direction", "address_prefixes"] + + +class AccessRuleProperties(_Model): + """Properties of an access rule. + + :ivar direction: Direction of the access rule. Known values are: "Inbound" and "Outbound". + :vartype direction: str or ~azure.mgmt.hybridcompute.models.AccessRuleDirection + :ivar address_prefixes: Address prefixes that are allowed access. + :vartype address_prefixes: list[str] + """ + + direction: Optional[Union[str, "_models.AccessRuleDirection"]] = rest_field(visibility=["read"]) + """Direction of the access rule. Known values are: \"Inbound\" and \"Outbound\".""" + address_prefixes: Optional[list[str]] = rest_field(name="addressPrefixes", visibility=["read"]) + """Address prefixes that are allowed access.""" + + +class AgentConfiguration(_Model): + """Configurable properties that the user can set locally via the azcmagent config command, or + remotely via ARM. + + :ivar proxy_url: Specifies the URL of the proxy to be used. + :vartype proxy_url: str + :ivar incoming_connections_ports: Specifies the list of ports that the agent will be able to + listen on. + :vartype incoming_connections_ports: list[str] + :ivar extensions_allow_list: Array of extensions that are allowed to be installed or updated. + :vartype extensions_allow_list: list[~azure.mgmt.hybridcompute.models.ConfigurationExtension] + :ivar extensions_block_list: Array of extensions that are blocked (cannot be installed or + updated). + :vartype extensions_block_list: list[~azure.mgmt.hybridcompute.models.ConfigurationExtension] + :ivar proxy_bypass: List of service names which should not use the specified proxy server. + :vartype proxy_bypass: list[str] + :ivar extensions_enabled: Specifies whether the extension service is enabled or disabled. + :vartype extensions_enabled: str + :ivar guest_configuration_enabled: Specified whether the guest configuration service is enabled + or disabled. + :vartype guest_configuration_enabled: str + :ivar config_mode: Name of configuration mode to use. Modes are pre-defined configurations of + security controls, extension allowlists and guest configuration, maintained by Microsoft. Known + values are: "full" and "monitor". + :vartype config_mode: str or ~azure.mgmt.hybridcompute.models.AgentConfigurationMode + """ + + proxy_url: Optional[str] = rest_field(name="proxyUrl", visibility=["read"]) + """Specifies the URL of the proxy to be used.""" + incoming_connections_ports: Optional[list[str]] = rest_field(name="incomingConnectionsPorts", visibility=["read"]) + """Specifies the list of ports that the agent will be able to listen on.""" + extensions_allow_list: Optional[list["_models.ConfigurationExtension"]] = rest_field( + name="extensionsAllowList", visibility=["read"] + ) + """Array of extensions that are allowed to be installed or updated.""" + extensions_block_list: Optional[list["_models.ConfigurationExtension"]] = rest_field( + name="extensionsBlockList", visibility=["read"] + ) + """Array of extensions that are blocked (cannot be installed or updated).""" + proxy_bypass: Optional[list[str]] = rest_field(name="proxyBypass", visibility=["read"]) + """List of service names which should not use the specified proxy server.""" + extensions_enabled: Optional[str] = rest_field(name="extensionsEnabled", visibility=["read"]) + """Specifies whether the extension service is enabled or disabled.""" + guest_configuration_enabled: Optional[str] = rest_field(name="guestConfigurationEnabled", visibility=["read"]) + """Specified whether the guest configuration service is enabled or disabled.""" + config_mode: Optional[Union[str, "_models.AgentConfigurationMode"]] = rest_field( + name="configMode", visibility=["read"] + ) + """Name of configuration mode to use. Modes are pre-defined configurations of security controls, + extension allowlists and guest configuration, maintained by Microsoft. Known values are: + \"full\" and \"monitor\".""" + + +class AgentUpgrade(_Model): + """The info w.r.t Agent Upgrade. + + :ivar desired_version: Specifies the version info w.r.t AgentUpgrade for the machine. + :vartype desired_version: str + :ivar correlation_id: The correlation ID associated with an agent upgrade operation. + :vartype correlation_id: str + :ivar enable_automatic_upgrade: Specifies if the machine's agent should be upgraded. + :vartype enable_automatic_upgrade: bool + :ivar last_attempt_desired_version: Specifies the version of the last attempt. + :vartype last_attempt_desired_version: str + :ivar last_attempt_timestamp: Timestamp of last upgrade attempt. + :vartype last_attempt_timestamp: ~datetime.datetime + :ivar last_attempt_status: Specifies the status of Agent Upgrade. Known values are: "Success" + and "Failed". + :vartype last_attempt_status: str or ~azure.mgmt.hybridcompute.models.LastAttemptStatusEnum + :ivar last_attempt_message: Failure message of last upgrade attempt if any. + :vartype last_attempt_message: str + """ + + desired_version: Optional[str] = rest_field( + name="desiredVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version info w.r.t AgentUpgrade for the machine.""" + correlation_id: Optional[str] = rest_field( + name="correlationId", visibility=["read", "create", "update", "delete", "query"] + ) + """The correlation ID associated with an agent upgrade operation.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if the machine's agent should be upgraded.""" + last_attempt_desired_version: Optional[str] = rest_field(name="lastAttemptDesiredVersion", visibility=["read"]) + """Specifies the version of the last attempt.""" + last_attempt_timestamp: Optional[datetime.datetime] = rest_field( + name="lastAttemptTimestamp", visibility=["read"], format="rfc3339" + ) + """Timestamp of last upgrade attempt.""" + last_attempt_status: Optional[Union[str, "_models.LastAttemptStatusEnum"]] = rest_field( + name="lastAttemptStatus", visibility=["read"] + ) + """Specifies the status of Agent Upgrade. Known values are: \"Success\" and \"Failed\".""" + last_attempt_message: Optional[str] = rest_field(name="lastAttemptMessage", visibility=["read"]) + """Failure message of last upgrade attempt if any.""" + + @overload + def __init__( + self, + *, + desired_version: Optional[str] = None, + correlation_id: Optional[str] = None, + enable_automatic_upgrade: 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 AvailablePatchCountByClassification(_Model): + """Summarization of patches available for installation on the machine by classification. + + :ivar security: Number of security patches available for installation. + :vartype security: int + :ivar critical: Number of critical patches available for installation. + :vartype critical: int + :ivar definition: Number of definition patches available for installation. + :vartype definition: int + :ivar update_rollup: Number of update Rollup patches available for installation. + :vartype update_rollup: int + :ivar feature_pack: Number of feature pack patches available for installation. + :vartype feature_pack: int + :ivar service_pack: Number of service pack patches available for installation. + :vartype service_pack: int + :ivar tools: Number of tools patches available for installation. + :vartype tools: int + :ivar updates: Number of updates category patches available for installation. + :vartype updates: int + :ivar other: Number of other patches available for installation. + :vartype other: int + """ + + security: Optional[int] = rest_field(visibility=["read"]) + """Number of security patches available for installation.""" + critical: Optional[int] = rest_field(visibility=["read"]) + """Number of critical patches available for installation.""" + definition: Optional[int] = rest_field(visibility=["read"]) + """Number of definition patches available for installation.""" + update_rollup: Optional[int] = rest_field(name="updateRollup", visibility=["read"]) + """Number of update Rollup patches available for installation.""" + feature_pack: Optional[int] = rest_field(name="featurePack", visibility=["read"]) + """Number of feature pack patches available for installation.""" + service_pack: Optional[int] = rest_field(name="servicePack", visibility=["read"]) + """Number of service pack patches available for installation.""" + tools: Optional[int] = rest_field(visibility=["read"]) + """Number of tools patches available for installation.""" + updates: Optional[int] = rest_field(visibility=["read"]) + """Number of updates category patches available for installation.""" + other: Optional[int] = rest_field(visibility=["read"]) + """Number of other patches available for installation.""" + + +class CloudMetadata(_Model): + """The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + + :ivar provider: Specifies the cloud provider (Azure/AWS/GCP...). + :vartype provider: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """Specifies the cloud provider (Azure/AWS/GCP...).""" + + +class ConfigurationExtension(_Model): + """Describes properties that can identify extensions. + + :ivar publisher: Publisher of the extension. + :vartype publisher: str + :ivar type: Type of the extension. + :vartype type: str + """ + + publisher: Optional[str] = rest_field(visibility=["read"]) + """Publisher of the extension.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Type of the extension.""" + + +class ConnectionDetail(_Model): + """ConnectionDetail. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar private_ip_address: The private endpoint connection private ip address. + :vartype private_ip_address: str + :ivar link_identifier: The private endpoint connection link identifier. + :vartype link_identifier: str + :ivar group_id: The private endpoint connection group id. + :vartype group_id: str + :ivar member_name: The private endpoint connection member name. + :vartype member_name: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Azure resource Id.""" + private_ip_address: Optional[str] = rest_field(name="privateIpAddress", visibility=["read"]) + """The private endpoint connection private ip address.""" + link_identifier: Optional[str] = rest_field(name="linkIdentifier", visibility=["read"]) + """The private endpoint connection link identifier.""" + group_id: Optional[str] = rest_field(name="groupId", visibility=["read"]) + """The private endpoint connection group id.""" + member_name: Optional[str] = rest_field(name="memberName", visibility=["read"]) + """The private endpoint connection member name.""" + + +class Disk(_Model): + """Describes a disk on the machine. + + :ivar path: The path of the disk. + :vartype path: str + :ivar disk_type: The type of the disk. + :vartype disk_type: str + :ivar generated_id: The generated ID of the disk. + :vartype generated_id: str + :ivar id: The ID of the disk. + :vartype id: str + :ivar name: The name of the disk. + :vartype name: str + :ivar max_size_in_bytes: The size of the disk, in bytes. + :vartype max_size_in_bytes: int + :ivar used_space_in_bytes: The amount of space used on the disk, in bytes. + :vartype used_space_in_bytes: int + """ + + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The path of the disk.""" + disk_type: Optional[str] = rest_field(name="diskType", visibility=["read", "create", "update", "delete", "query"]) + """The type of the disk.""" + generated_id: Optional[str] = rest_field( + name="generatedId", visibility=["read", "create", "update", "delete", "query"] + ) + """The generated ID of the disk.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the disk.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the disk.""" + max_size_in_bytes: Optional[int] = rest_field( + name="maxSizeInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The size of the disk, in bytes.""" + used_space_in_bytes: Optional[int] = rest_field( + name="usedSpaceInBytes", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of space used on the disk, in bytes.""" + + @overload + def __init__( + self, + *, + path: Optional[str] = None, + disk_type: Optional[str] = None, + generated_id: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + max_size_in_bytes: Optional[int] = None, + used_space_in_bytes: Optional[int] = 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.hybridcompute.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.hybridcompute.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.hybridcompute.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 EsuKey(_Model): + """ESU key. + + :ivar sku: SKU number. + :vartype sku: str + :ivar license_status: The current status of the license profile key. Represented by the same + integer value that is presented on the machine itself when querying the license key status. + :vartype license_status: int + """ + + sku: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """SKU number.""" + license_status: Optional[int] = rest_field( + name="licenseStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The current status of the license profile key. Represented by the same integer value that is + presented on the machine itself when querying the license key status.""" + + @overload + def __init__( + self, + *, + sku: Optional[str] = None, + license_status: Optional[int] = 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 EsuProfileUpdateProperties(_Model): + """Describes the Update properties of a ESU License Profile. + + :ivar assigned_license: The resource id of the license. + :vartype assigned_license: str + """ + + assigned_license: Optional[str] = rest_field( + name="assignedLicense", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the license.""" + + @overload + def __init__( + self, + *, + assigned_license: 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 ExtensionPublisher(_Model): + """Describes an Extension Publisher. + + :ivar id: The ID of the extension publisher. + :vartype id: str + :ivar name: The name of the extension publisher. + :vartype name: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the extension publisher.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension publisher.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + 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 ExtensionsResourceStatus(_Model): + """Instance view status. + + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.hybridcompute.models.ExtensionsStatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status code.""" + level: Optional[Union[str, "_models.ExtensionsStatusLevelTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The level code. Known values are: \"Info\", \"Warning\", and \"Error\".""" + display_status: Optional[str] = rest_field( + name="displayStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The short localizable label for the status.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The detailed status message, including for alerts and error messages.""" + time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time of the status.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + level: Optional[Union[str, "_models.ExtensionsStatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: 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 ExtensionTargetProperties(_Model): + """Describes the Machine Extension Target Version Properties. + + :ivar target_version: Properties for the specified Extension to Upgrade. + :vartype target_version: str + """ + + target_version: Optional[str] = rest_field( + name="targetVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties for the specified Extension to Upgrade.""" + + @overload + def __init__( + self, + *, + target_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 ExtensionType(_Model): + """Describes an Extension Type. + + :ivar id: The ID of the extension type. + :vartype id: str + :ivar name: The name of the extension type. + :vartype name: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The ID of the extension type.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension type.""" + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + 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 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 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.hybridcompute.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 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 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.hybridcompute.models.SystemData + """ + + +class ExtensionValue(ProxyResource): + """Describes a Extension Metadata. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar properties: The single extension based on search criteria. + :vartype properties: ~azure.mgmt.hybridcompute.models.ExtensionValueProperties + """ + + properties: Optional["_models.ExtensionValueProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The single extension based on search criteria.""" + + __flattened_items = ["version", "extension_type", "publisher"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ExtensionValueProperties"] = 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 ExtensionValueProperties(_Model): + """Describes Extension Metadata properties. + + :ivar version: The version of the Extension being received. + :vartype version: str + :ivar extension_type: The type of the Extension being received. + :vartype extension_type: str + :ivar publisher: The publisher of the Extension being received. + :vartype publisher: str + """ + + version: Optional[str] = rest_field(visibility=["read"]) + """The version of the Extension being received.""" + extension_type: Optional[str] = rest_field(name="extensionType", visibility=["read"]) + """The type of the Extension being received.""" + publisher: Optional[str] = rest_field(visibility=["read"]) + """The publisher of the Extension being received.""" + + +class ExtensionValueV2(ProxyResource): + """Describes an Extension Metadata. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar properties: The single extension based on search criteria. + :vartype properties: ~azure.mgmt.hybridcompute.models.ExtensionValueV2Properties + """ + + properties: Optional["_models.ExtensionValueV2Properties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The single extension based on search criteria.""" + + __flattened_items = [ + "version", + "extension_type", + "publisher", + "extension_uris", + "extension_signature_uri", + "operating_system", + "architecture", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ExtensionValueV2Properties"] = 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 ExtensionValueV2Properties(ExtensionValueProperties): + """Describes Extension Metadata properties. + + :ivar version: The version of the Extension being received. + :vartype version: str + :ivar extension_type: The type of the Extension being received. + :vartype extension_type: str + :ivar publisher: The publisher of the Extension being received. + :vartype publisher: str + :ivar extension_uris: A list of locations where the extension packages can be found. + :vartype extension_uris: list[str] + :ivar extension_signature_uri: Location of the signature files for the extension. + :vartype extension_signature_uri: str + :ivar operating_system: The operating system (Windows, Linux, etc.) this extension supports. + :vartype operating_system: str + :ivar architecture: Architectures (x64, arms64, etc.) that this extension supports. + :vartype architecture: list[str] + """ + + extension_uris: Optional[list[str]] = rest_field(name="extensionUris", visibility=["read"]) + """A list of locations where the extension packages can be found.""" + extension_signature_uri: Optional[str] = rest_field(name="extensionSignatureUri", visibility=["read"]) + """Location of the signature files for the extension.""" + operating_system: Optional[str] = rest_field(name="operatingSystem", visibility=["read"]) + """The operating system (Windows, Linux, etc.) this extension supports.""" + architecture: Optional[list[str]] = rest_field(visibility=["read"]) + """Architectures (x64, arms64, etc.) that this extension supports.""" + + +class FirmwareProfile(_Model): + """Describes the firmware of the machine. + + :ivar serial_number: The serial number of the firmware. + :vartype serial_number: str + :ivar type: The type of the firmware. + :vartype type: str + """ + + serial_number: Optional[str] = rest_field(name="serialNumber", visibility=["read"]) + """The serial number of the firmware.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the firmware.""" + + +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 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.hybridcompute.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 Gateway(TrackedResource): + """Describes an Arc Gateway. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Hybrid Compute Gateway properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.GatewayProperties + """ + + properties: Optional["_models.GatewayProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute Gateway properties.""" + + __flattened_items = ["provisioning_state", "gateway_id", "gateway_type", "gateway_endpoint", "allowed_features"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GatewayProperties"] = 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 GatewayProperties(_Model): + """Describes the properties of a Gateway Profile. + + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", + and "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState + :ivar gateway_id: A unique, immutable, identifier for the Gateway. + :vartype gateway_id: str + :ivar gateway_type: The type of the Gateway resource. "Public" + :vartype gateway_type: str or ~azure.mgmt.hybridcompute.models.GatewayType + :ivar gateway_endpoint: The endpoint fqdn for the Gateway. + :vartype gateway_endpoint: str + :ivar allowed_features: Specifies the list of features that are enabled for this Gateway. + :vartype allowed_features: list[str] + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Accepted\", \"Canceled\", and + \"Deleted\".""" + gateway_id: Optional[str] = rest_field(name="gatewayId", visibility=["read"]) + """A unique, immutable, identifier for the Gateway.""" + gateway_type: Optional[Union[str, "_models.GatewayType"]] = rest_field( + name="gatewayType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the Gateway resource. \"Public\"""" + gateway_endpoint: Optional[str] = rest_field(name="gatewayEndpoint", visibility=["read"]) + """The endpoint fqdn for the Gateway.""" + allowed_features: Optional[list[str]] = rest_field( + name="allowedFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the list of features that are enabled for this Gateway.""" + + @overload + def __init__( + self, + *, + gateway_type: Optional[Union[str, "_models.GatewayType"]] = None, + allowed_features: 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 ResourceUpdate(_Model): + """The Update Resource model definition. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + 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 GatewayUpdate(ResourceUpdate): + """Describes a License Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Gateway Update properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.GatewayUpdateProperties + """ + + properties: Optional["_models.GatewayUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Gateway Update properties.""" + + __flattened_items = ["allowed_features"] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.GatewayUpdateProperties"] = 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 GatewayUpdateProperties(_Model): + """Describes the Update properties of a Gateway Profile. + + :ivar allowed_features: Specifies the list of features that are enabled for this Gateway. + :vartype allowed_features: list[str] + """ + + allowed_features: Optional[list[str]] = rest_field( + name="allowedFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the list of features that are enabled for this Gateway.""" + + @overload + def __init__( + self, + *, + allowed_features: 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 HardwareProfile(_Model): + """Describes the hardware of the machine. + + :ivar total_physical_memory_in_bytes: The total physical memory on the machine. + :vartype total_physical_memory_in_bytes: int + :ivar number_of_cpu_sockets: The total number of CPU sockets available on the machine. + :vartype number_of_cpu_sockets: int + :ivar processors: The physical processors of the machine. + :vartype processors: list[~azure.mgmt.hybridcompute.models.Processor] + """ + + total_physical_memory_in_bytes: Optional[int] = rest_field(name="totalPhysicalMemoryInBytes", visibility=["read"]) + """The total physical memory on the machine.""" + number_of_cpu_sockets: Optional[int] = rest_field(name="numberOfCpuSockets", visibility=["read"]) + """The total number of CPU sockets available on the machine.""" + processors: Optional[list["_models.Processor"]] = rest_field(visibility=["read"]) + """The physical processors of the machine.""" + + +class HybridComputePrivateLinkScope(TrackedResource): + """An Azure Arc PrivateLinkScope definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Properties that define a Azure Arc PrivateLinkScope resource. + :vartype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties + """ + + properties: Optional["_models.HybridComputePrivateLinkScopeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties that define a Azure Arc PrivateLinkScope resource.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.HybridComputePrivateLinkScopeProperties"] = 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 HybridComputePrivateLinkScopeProperties(_Model): + """Properties that define a Azure Arc PrivateLinkScope resource. + + :ivar public_network_access: Indicates whether machines associated with the private link scope + can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", and + "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType + :ivar provisioning_state: Current state of this PrivateLinkScope: whether or not is has been + provisioned within the resource group it is defined. Users cannot change this value but are + able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. + :vartype provisioning_state: str + :ivar private_link_scope_id: The Guid id of the private link scope. + :vartype private_link_scope_id: str + :ivar private_endpoint_connections: The collection of associated Private Endpoint Connections. + :vartype private_endpoint_connections: + list[~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionDataModel] + :ivar service_extensions: Enable private link validation for an Azure Arc Extension. + :vartype service_extensions: list[~azure.mgmt.hybridcompute.models.ServiceExtension] + """ + + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether machines associated with the private link scope can also use public Azure Arc + service endpoints. Known values are: \"Enabled\", \"Disabled\", and \"SecuredByPerimeter\".""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Current state of this PrivateLinkScope: whether or not is has been provisioned within the + resource group it is defined. Users cannot change this value but are able to read from it. + Values will include Provisioning ,Succeeded, Canceled and Failed.""" + private_link_scope_id: Optional[str] = rest_field(name="privateLinkScopeId", visibility=["read"]) + """The Guid id of the private link scope.""" + private_endpoint_connections: Optional[list["_models.PrivateEndpointConnectionDataModel"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """The collection of associated Private Endpoint Connections.""" + service_extensions: Optional[list["_models.ServiceExtension"]] = rest_field( + name="serviceExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable private link validation for an Azure Arc Extension.""" + + @overload + def __init__( + self, + *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + service_extensions: Optional[list["_models.ServiceExtension"]] = 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 Identity(_Model): + """Identity for the resource. + + :ivar principal_id: The principal ID of resource identity. The value must be an UUID. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of resource. The value must be an UUID. + :vartype tenant_id: str + :ivar type: The identity type. "SystemAssigned" + :vartype type: str or ~azure.mgmt.hybridcompute.models.ResourceIdentityType + """ + + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal ID of resource identity. The value must be an UUID.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant ID of resource. The value must be an UUID.""" + type: Optional[Union[str, "_models.ResourceIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The identity type. \"SystemAssigned\"""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ResourceIdentityType"]] = 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 IpAddress(_Model): + """Describes properties of the IP address. + + :ivar address: Represents the IP Address. + :vartype address: str + :ivar ip_address_version: Represents the Ip Address Version. + :vartype ip_address_version: str + :ivar subnet: The subnet to which this IP address belongs. + :vartype subnet: ~azure.mgmt.hybridcompute.models.Subnet + """ + + address: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Represents the IP Address.""" + ip_address_version: Optional[str] = rest_field( + name="ipAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents the Ip Address Version.""" + subnet: Optional["_models.Subnet"] = rest_field(visibility=["read"]) + """The subnet to which this IP address belongs.""" + + @overload + def __init__( + self, + *, + address: Optional[str] = None, + ip_address_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 License(TrackedResource): + """Describes a license in a hybrid machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Hybrid Compute License properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.LicenseProperties + """ + + properties: Optional["_models.LicenseProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute License properties.""" + + __flattened_items = ["provisioning_state", "tenant_id", "license_type", "license_details"] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.LicenseProperties"] = 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 LicenseDetails(_Model): + """Describes the properties of a License. + + :ivar state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and + "Windows Server 2012 R2". + :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :ivar edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :ivar processors: Describes the number of processors. + :vartype processors: int + :ivar assigned_licenses: Describes the number of assigned licenses. + :vartype assigned_licenses: int + :ivar immutable_id: Describes the immutable id. + :vartype immutable_id: str + :ivar volume_license_details: A list of volume license details. + :vartype volume_license_details: list[~azure.mgmt.hybridcompute.models.VolumeLicenseDetails] + """ + + state: Optional[Union[str, "_models.LicenseState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the state of the license. Known values are: \"Activated\" and \"Deactivated\".""" + target: Optional[Union[str, "_models.LicenseTarget"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the license target server. Known values are: \"Windows Server 2012\" and \"Windows + Server 2012 R2\".""" + edition: Optional[Union[str, "_models.LicenseEdition"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the edition of the license. The values are either Standard or Datacenter. Known + values are: \"Standard\" and \"Datacenter\".""" + type: Optional[Union[str, "_models.LicenseCoreType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the license core type (pCore or vCore). Known values are: \"pCore\" and \"vCore\".""" + processors: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the number of processors.""" + assigned_licenses: Optional[int] = rest_field(name="assignedLicenses", visibility=["read"]) + """Describes the number of assigned licenses.""" + immutable_id: Optional[str] = rest_field(name="immutableId", visibility=["read"]) + """Describes the immutable id.""" + volume_license_details: Optional[list["_models.VolumeLicenseDetails"]] = rest_field( + name="volumeLicenseDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """A list of volume license details.""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.LicenseState"]] = None, + target: Optional[Union[str, "_models.LicenseTarget"]] = None, + edition: Optional[Union[str, "_models.LicenseEdition"]] = None, + type: Optional[Union[str, "_models.LicenseCoreType"]] = None, + processors: Optional[int] = None, + volume_license_details: Optional[list["_models.VolumeLicenseDetails"]] = 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 LicenseProfile(TrackedResource): + """Describes a license profile in a hybrid machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Describe the properties of a license profile. + :vartype properties: ~azure.mgmt.hybridcompute.models.LicenseProfileProperties + """ + + properties: Optional["_models.LicenseProfileProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describe the properties of a license profile.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.LicenseProfileProperties"] = 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 LicenseProfileStorageModelEsuProperties(_Model): + """License profile storage model for ESU properties. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + """ + + assigned_license_immutable_id: Optional[str] = rest_field(name="assignedLicenseImmutableId", visibility=["read"]) + """The guid id of the license.""" + esu_keys: Optional[list["_models.EsuKey"]] = rest_field(name="esuKeys", visibility=["read"]) + """The list of ESU keys.""" + + +class LicenseProfileArmEsuPropertiesWithoutAssignedLicense( + LicenseProfileStorageModelEsuProperties +): # pylint: disable=name-too-long + """Describes the properties of a License Profile ARM model. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + """ + + server_type: Optional[Union[str, "_models.EsuServerType"]] = rest_field(name="serverType", visibility=["read"]) + """The type of the Esu servers. Known values are: \"Standard\" and \"Datacenter\".""" + esu_eligibility: Optional[Union[str, "_models.EsuEligibility"]] = rest_field( + name="esuEligibility", visibility=["read"] + ) + """Indicates the eligibility state of Esu. Known values are: \"Eligible\", \"Ineligible\", and + \"Unknown\".""" + esu_key_state: Optional[Union[str, "_models.EsuKeyState"]] = rest_field(name="esuKeyState", visibility=["read"]) + """Indicates whether there is an ESU Key currently active for the machine. Known values are: + \"Inactive\" and \"Active\".""" + + +class LicenseProfileArmEsuProperties(LicenseProfileArmEsuPropertiesWithoutAssignedLicense): + """Describes the properties of a License Profile ARM model. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + :ivar assigned_license: The resource id of the license. + :vartype assigned_license: str + """ + + assigned_license: Optional[str] = rest_field( + name="assignedLicense", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the license.""" + + @overload + def __init__( + self, + *, + assigned_license: 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 LicenseProfileArmProductProfileProperties(_Model): # pylint: disable=name-too-long + """Describes the properties of a Product License Profile ARM model. + + :ivar subscription_status: Indicates the subscription status of the product. Known values are: + "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". + :vartype subscription_status: str or + ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus + :ivar product_type: Indicates the product type of the license. Known values are: + "WindowsServer" and "WindowsIoTEnterprise". + :vartype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType + :ivar enrollment_date: The timestamp in UTC when the user enrolls the feature. + :vartype enrollment_date: ~datetime.datetime + :ivar billing_start_date: The timestamp in UTC when the billing starts. + :vartype billing_start_date: ~datetime.datetime + :ivar disenrollment_date: The timestamp in UTC when the user disenrolled the feature. + :vartype disenrollment_date: ~datetime.datetime + :ivar billing_end_date: The timestamp in UTC when the billing ends. + :vartype billing_end_date: ~datetime.datetime + :ivar error: The errors that were encountered during the feature enrollment or disenrollment. + :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail + :ivar product_features: The list of product features. + :vartype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeature] + """ + + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = rest_field( + name="subscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the subscription status of the product. Known values are: \"Unknown\", \"Enabling\", + \"Enabled\", \"Disabled\", \"Disabling\", and \"Failed\".""" + product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = rest_field( + name="productType", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the product type of the license. Known values are: \"WindowsServer\" and + \"WindowsIoTEnterprise\".""" + enrollment_date: Optional[datetime.datetime] = rest_field( + name="enrollmentDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the user enrolls the feature.""" + billing_start_date: Optional[datetime.datetime] = rest_field( + name="billingStartDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the billing starts.""" + disenrollment_date: Optional[datetime.datetime] = rest_field( + name="disenrollmentDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the user disenrolled the feature.""" + billing_end_date: Optional[datetime.datetime] = rest_field( + name="billingEndDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the billing ends.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read"]) + """The errors that were encountered during the feature enrollment or disenrollment.""" + product_features: Optional[list["_models.ProductFeature"]] = rest_field( + name="productFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of product features.""" + + @overload + def __init__( + self, + *, + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = None, + product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = None, + product_features: Optional[list["_models.ProductFeature"]] = 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 LicenseProfileMachineInstanceView(_Model): + """License Profile Instance View in Machine Properties. + + :ivar license_status: Indicates the license status of the OS. Known values are: "Unlicensed", + "Licensed", "OOBGrace", "OOTGrace", "NonGenuineGrace", "Notification", and "ExtendedGrace". + :vartype license_status: str or ~azure.mgmt.hybridcompute.models.LicenseStatus + :ivar license_channel: Indicates the license channel. + :vartype license_channel: str + :ivar software_assurance: + :vartype software_assurance: + ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewSoftwareAssurance + :ivar esu_profile: Properties for the Machine ESU profile. + :vartype esu_profile: + ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties + :ivar product_profile: Hybrid Compute Product Profile properties. + :vartype product_profile: + ~azure.mgmt.hybridcompute.models.LicenseProfileArmProductProfileProperties + """ + + license_status: Optional[Union[str, "_models.LicenseStatus"]] = rest_field( + name="licenseStatus", visibility=["read"] + ) + """Indicates the license status of the OS. Known values are: \"Unlicensed\", \"Licensed\", + \"OOBGrace\", \"OOTGrace\", \"NonGenuineGrace\", \"Notification\", and \"ExtendedGrace\".""" + license_channel: Optional[str] = rest_field(name="licenseChannel", visibility=["read"]) + """Indicates the license channel.""" + software_assurance: Optional["_models.LicenseProfileMachineInstanceViewSoftwareAssurance"] = rest_field( + name="softwareAssurance", visibility=["read"] + ) + esu_profile: Optional["_models.LicenseProfileMachineInstanceViewEsuProperties"] = rest_field( + name="esuProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Properties for the Machine ESU profile.""" + product_profile: Optional["_models.LicenseProfileArmProductProfileProperties"] = rest_field( + name="productProfile", visibility=["read"] + ) + """Hybrid Compute Product Profile properties.""" + + __flattened_items = [ + "software_assurance_customer", + "subscription_status", + "product_type", + "enrollment_date", + "billing_start_date", + "disenrollment_date", + "billing_end_date", + "error", + "product_features", + ] + + @overload + def __init__( + self, + *, + esu_profile: Optional["_models.LicenseProfileMachineInstanceViewEsuProperties"] = 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.software_assurance is None: + return None + return getattr(self.software_assurance, 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.software_assurance is None: + self.software_assurance = self._attr_to_rest_field["software_assurance"]._class_type() + setattr(self.software_assurance, key, value) + else: + super().__setattr__(key, value) + + +class LicenseProfileMachineInstanceViewEsuProperties( + LicenseProfileArmEsuPropertiesWithoutAssignedLicense +): # pylint: disable=name-too-long + """Properties for the Machine ESU profile. + + :ivar assigned_license_immutable_id: The guid id of the license. + :vartype assigned_license_immutable_id: str + :ivar esu_keys: The list of ESU keys. + :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] + :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". + :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType + :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", + "Ineligible", and "Unknown". + :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility + :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. + Known values are: "Inactive" and "Active". + :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState + :ivar assigned_license: The assigned license resource. + :vartype assigned_license: ~azure.mgmt.hybridcompute.models.License + :ivar license_assignment_state: Describes the license assignment state (Assigned or + NotAssigned). Known values are: "Assigned" and "NotAssigned". + :vartype license_assignment_state: str or + ~azure.mgmt.hybridcompute.models.LicenseAssignmentState + """ + + assigned_license: Optional["_models.License"] = rest_field( + name="assignedLicense", visibility=["read", "create", "update", "delete", "query"] + ) + """The assigned license resource.""" + license_assignment_state: Optional[Union[str, "_models.LicenseAssignmentState"]] = rest_field( + name="licenseAssignmentState", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the license assignment state (Assigned or NotAssigned). Known values are: + \"Assigned\" and \"NotAssigned\".""" + + @overload + def __init__( + self, + *, + assigned_license: Optional["_models.License"] = None, + license_assignment_state: Optional[Union[str, "_models.LicenseAssignmentState"]] = 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 LicenseProfileMachineInstanceViewSoftwareAssurance(_Model): # pylint: disable=name-too-long + """LicenseProfileMachineInstanceViewSoftwareAssurance. + + :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software + Assurance agreement. + :vartype software_assurance_customer: bool + """ + + software_assurance_customer: Optional[bool] = rest_field( + name="softwareAssuranceCustomer", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if this machine is licensed as part of a Software Assurance agreement.""" + + @overload + def __init__( + self, + *, + software_assurance_customer: 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 LicenseProfileProperties(_Model): + """Describe the properties of a license profile. + + :ivar software_assurance: + :vartype software_assurance: + ~azure.mgmt.hybridcompute.models.LicenseProfilePropertiesSoftwareAssurance + :ivar esu_profile: Hybrid Compute ESU Profile properties. + :vartype esu_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileArmEsuProperties + :ivar product_profile: Hybrid Compute Product Profile properties. + :vartype product_profile: + ~azure.mgmt.hybridcompute.models.LicenseProfileArmProductProfileProperties + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", + and "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState + """ + + software_assurance: Optional["_models.LicenseProfilePropertiesSoftwareAssurance"] = rest_field( + name="softwareAssurance", visibility=["read", "create", "update", "delete", "query"] + ) + esu_profile: Optional["_models.LicenseProfileArmEsuProperties"] = rest_field( + name="esuProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute ESU Profile properties.""" + product_profile: Optional["_models.LicenseProfileArmProductProfileProperties"] = rest_field( + name="productProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute Product Profile properties.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Accepted\", \"Canceled\", and + \"Deleted\".""" + + __flattened_items = [ + "software_assurance_customer", + "assigned_license_immutable_id", + "esu_keys", + "server_type", + "esu_eligibility", + "esu_key_state", + "assigned_license", + "subscription_status", + "product_type", + "enrollment_date", + "billing_start_date", + "disenrollment_date", + "billing_end_date", + "error", + "product_features", + ] + + @overload + def __init__( + self, + *, + software_assurance: Optional["_models.LicenseProfilePropertiesSoftwareAssurance"] = None, + esu_profile: Optional["_models.LicenseProfileArmEsuProperties"] = None, + product_profile: Optional["_models.LicenseProfileArmProductProfileProperties"] = 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.software_assurance is None: + return None + return getattr(self.software_assurance, 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.software_assurance is None: + self.software_assurance = self._attr_to_rest_field["software_assurance"]._class_type() + setattr(self.software_assurance, key, value) + else: + super().__setattr__(key, value) + + +class LicenseProfilePropertiesSoftwareAssurance(_Model): # pylint: disable=name-too-long + """LicenseProfilePropertiesSoftwareAssurance. + + :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software + Assurance agreement. + :vartype software_assurance_customer: bool + """ + + software_assurance_customer: Optional[bool] = rest_field( + name="softwareAssuranceCustomer", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if this machine is licensed as part of a Software Assurance agreement.""" + + @overload + def __init__( + self, + *, + software_assurance_customer: 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 LicenseProfileUpdate(ResourceUpdate): + """Describes a License Profile Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describe the Update properties of a license profile. + :vartype properties: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdateProperties + """ + + properties: Optional["_models.LicenseProfileUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describe the Update properties of a license profile.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.LicenseProfileUpdateProperties"] = 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 LicenseProfileUpdateProperties(_Model): + """Describe the Update properties of a license profile. + + :ivar software_assurance: + :vartype software_assurance: + ~azure.mgmt.hybridcompute.models.LicenseProfileUpdatePropertiesSoftwareAssurance + :ivar esu_profile: Hybrid Compute ESU Profile Update properties. + :vartype esu_profile: ~azure.mgmt.hybridcompute.models.EsuProfileUpdateProperties + :ivar product_profile: Hybrid Compute Product Profile Update properties. + :vartype product_profile: ~azure.mgmt.hybridcompute.models.ProductProfileUpdateProperties + """ + + software_assurance: Optional["_models.LicenseProfileUpdatePropertiesSoftwareAssurance"] = rest_field( + name="softwareAssurance", visibility=["read", "create", "update", "delete", "query"] + ) + esu_profile: Optional["_models.EsuProfileUpdateProperties"] = rest_field( + name="esuProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute ESU Profile Update properties.""" + product_profile: Optional["_models.ProductProfileUpdateProperties"] = rest_field( + name="productProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute Product Profile Update properties.""" + + __flattened_items = [ + "software_assurance_customer", + "assigned_license", + "subscription_status", + "product_type", + "product_features", + ] + + @overload + def __init__( + self, + *, + software_assurance: Optional["_models.LicenseProfileUpdatePropertiesSoftwareAssurance"] = None, + esu_profile: Optional["_models.EsuProfileUpdateProperties"] = None, + product_profile: Optional["_models.ProductProfileUpdateProperties"] = 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.software_assurance is None: + return None + return getattr(self.software_assurance, 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.software_assurance is None: + self.software_assurance = self._attr_to_rest_field["software_assurance"]._class_type() + setattr(self.software_assurance, key, value) + else: + super().__setattr__(key, value) + + +class LicenseProfileUpdatePropertiesSoftwareAssurance(_Model): # pylint: disable=name-too-long + """LicenseProfileUpdatePropertiesSoftwareAssurance. + + :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software + Assurance agreement. + :vartype software_assurance_customer: bool + """ + + software_assurance_customer: Optional[bool] = rest_field( + name="softwareAssuranceCustomer", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies if this machine is licensed as part of a Software Assurance agreement.""" + + @overload + def __init__( + self, + *, + software_assurance_customer: 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 LicenseProperties(_Model): + """Describes the properties of a License Profile. + + :ivar provisioning_state: The provisioning state, which only appears in the response. Known + values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", + and "Deleted". + :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState + :ivar tenant_id: Describes the tenant id. + :vartype tenant_id: str + :ivar license_type: The type of the license resource. "ESU" + :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :ivar license_details: Describes the properties of a License. + :vartype license_details: ~azure.mgmt.hybridcompute.models.LicenseDetails + """ + + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state, which only appears in the response. Known values are: \"Creating\", + \"Updating\", \"Deleting\", \"Succeeded\", \"Failed\", \"Accepted\", \"Canceled\", and + \"Deleted\".""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """Describes the tenant id.""" + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the license resource. \"ESU\"""" + license_details: Optional["_models.LicenseDetails"] = rest_field( + name="licenseDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a License.""" + + @overload + def __init__( + self, + *, + tenant_id: Optional[str] = None, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + license_details: Optional["_models.LicenseDetails"] = 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 LicenseUpdate(ResourceUpdate): + """Describes a License Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: License Update properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.LicenseUpdateProperties + """ + + properties: Optional["_models.LicenseUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """License Update properties.""" + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.LicenseUpdateProperties"] = 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 LicenseUpdateProperties(_Model): + """Describes the Update properties of a License Profile. + + :ivar license_type: The type of the license resource. "ESU" + :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType + :ivar license_details: + :vartype license_details: + ~azure.mgmt.hybridcompute.models.LicenseUpdatePropertiesLicenseDetails + """ + + license_type: Optional[Union[str, "_models.LicenseType"]] = rest_field( + name="licenseType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the license resource. \"ESU\"""" + license_details: Optional["_models.LicenseUpdatePropertiesLicenseDetails"] = rest_field( + name="licenseDetails", visibility=["read", "create", "update", "delete", "query"] + ) + + __flattened_items = ["state", "target", "edition", "type", "processors"] + + @overload + def __init__( + self, + *, + license_type: Optional[Union[str, "_models.LicenseType"]] = None, + license_details: Optional["_models.LicenseUpdatePropertiesLicenseDetails"] = 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.license_details is None: + return None + return getattr(self.license_details, 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.license_details is None: + self.license_details = self._attr_to_rest_field["license_details"]._class_type() + setattr(self.license_details, key, value) + else: + super().__setattr__(key, value) + + +class LicenseUpdatePropertiesLicenseDetails(_Model): + """LicenseUpdatePropertiesLicenseDetails. + + :ivar state: Describes the state of the license. Known values are: "Activated" and + "Deactivated". + :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState + :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and + "Windows Server 2012 R2". + :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget + :ivar edition: Describes the edition of the license. The values are either Standard or + Datacenter. Known values are: "Standard" and "Datacenter". + :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition + :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and + "vCore". + :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType + :ivar processors: Describes the number of processors. + :vartype processors: int + """ + + state: Optional[Union[str, "_models.LicenseState"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the state of the license. Known values are: \"Activated\" and \"Deactivated\".""" + target: Optional[Union[str, "_models.LicenseTarget"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the license target server. Known values are: \"Windows Server 2012\" and \"Windows + Server 2012 R2\".""" + edition: Optional[Union[str, "_models.LicenseEdition"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the edition of the license. The values are either Standard or Datacenter. Known + values are: \"Standard\" and \"Datacenter\".""" + type: Optional[Union[str, "_models.LicenseCoreType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the license core type (pCore or vCore). Known values are: \"pCore\" and \"vCore\".""" + processors: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Describes the number of processors.""" + + @overload + def __init__( + self, + *, + state: Optional[Union[str, "_models.LicenseState"]] = None, + target: Optional[Union[str, "_models.LicenseTarget"]] = None, + edition: Optional[Union[str, "_models.LicenseEdition"]] = None, + type: Optional[Union[str, "_models.LicenseCoreType"]] = None, + processors: Optional[int] = 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 LinuxParameters(_Model): + """Input for InstallPatches on a Linux VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Linux. + :vartype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux] + :ivar package_name_masks_to_include: packages to include in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_include: list[str] + :ivar package_name_masks_to_exclude: packages to exclude in the patch operation. Format: + packageName_packageVersion. + :vartype package_name_masks_to_exclude: list[str] + """ + + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = rest_field( + name="classificationsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The update classifications to select when installing patches for Linux.""" + package_name_masks_to_include: Optional[list[str]] = rest_field( + name="packageNameMasksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """packages to include in the patch operation. Format: packageName_packageVersion.""" + package_name_masks_to_exclude: Optional[list[str]] = rest_field( + name="packageNameMasksToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """packages to exclude in the patch operation. Format: packageName_packageVersion.""" + + @overload + def __init__( + self, + *, + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, + package_name_masks_to_include: Optional[list[str]] = None, + package_name_masks_to_exclude: 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 LocationData(_Model): + """Metadata pertaining to the geographic location of the resource. + + :ivar name: A canonical name for the geographic or physical location. Required. + :vartype name: str + :ivar city: The city or locality where the resource is located. + :vartype city: str + :ivar district: The district, state, or province where the resource is located. + :vartype district: str + :ivar country_or_region: The country or region where the resource is located. + :vartype country_or_region: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A canonical name for the geographic or physical location. Required.""" + city: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The city or locality where the resource is located.""" + district: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The district, state, or province where the resource is located.""" + country_or_region: Optional[str] = rest_field( + name="countryOrRegion", visibility=["read", "create", "update", "delete", "query"] + ) + """The country or region where the resource is located.""" + + @overload + def __init__( + self, + *, + name: str, + city: Optional[str] = None, + district: Optional[str] = None, + country_or_region: 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 Machine(TrackedResource): + """Describes a hybrid machine. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Hybrid Compute Machine properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.MachineProperties + :ivar resources: The list of extensions affiliated to the machine. + :vartype resources: list[~azure.mgmt.hybridcompute.models.MachineExtension] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.hybridcompute.models.Identity + :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum + """ + + properties: Optional["_models.MachineProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute Machine properties.""" + resources: Optional[list["_models.MachineExtension"]] = rest_field(visibility=["read"]) + """The list of extensions affiliated to the machine.""" + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity for the resource.""" + kind: Optional[Union[str, "_models.ArcKindEnum"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Known values are: \"AVS\", \"HCI\", \"SCVMM\", \"VMware\", \"EPS\", \"GCP\", and \"AWS\".""" + + __flattened_items = [ + "location_data", + "agent_configuration", + "service_statuses", + "hardware_profile", + "storage_profile", + "firmware_profile", + "cloud_metadata", + "agent_upgrade", + "os_profile", + "license_profile", + "provisioning_state", + "status", + "last_status_change", + "error_details", + "agent_version", + "vm_id", + "display_name", + "machine_fqdn", + "client_public_key", + "identity_key_store", + "tpm_ek_certificate", + "os_name", + "os_version", + "os_type", + "vm_uuid", + "extensions", + "os_sku", + "os_edition", + "domain_name", + "ad_fqdn", + "dns_fqdn", + "private_link_scope_resource_id", + "parent_cluster_resource_id", + "hardware_resource_id", + "mssql_discovered", + "detected_properties", + "network_profile", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.MachineProperties"] = None, + identity: Optional["_models.Identity"] = None, + kind: Optional[Union[str, "_models.ArcKindEnum"]] = 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 MachineAssessPatchesResult(_Model): + """Describes the properties of an AssessPatches result. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", + or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", + and "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus + :ivar assessment_activity_id: The activity ID of the operation that produced this result. + :vartype assessment_activity_id: str + :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially + installed patches require a reboot to complete installation but the reboot has not yet + occurred. + :vartype reboot_pending: bool + :ivar available_patch_count_by_classification: Summarization of patches available for + installation on the machine by classification. + :vartype available_patch_count_by_classification: + ~azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp when the operation finished. + :vartype last_modified_date_time: ~datetime.datetime + :ivar started_by: Indicates if operation was triggered by user or by platform. Known values + are: "User" and "Platform". + :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy + :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: + "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". + :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed + :ivar os_type: The operating system type of the machine. Known values are: "Windows" and + "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType + :ivar error_details: The errors that were encountered during execution of the operation. The + details array contains the list of them. + :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Unknown\", \"Failed\", \"Succeeded\", or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + assessment_activity_id: Optional[str] = rest_field(name="assessmentActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result.""" + reboot_pending: Optional[bool] = rest_field(name="rebootPending", visibility=["read"]) + """The overall reboot status of the VM. It will be true when partially installed patches require a + reboot to complete installation but the reboot has not yet occurred.""" + available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = rest_field( + name="availablePatchCountByClassification", visibility=["read", "create", "update", "delete", "query"] + ) + """Summarization of patches available for installation on the machine by classification.""" + start_date_time: Optional[datetime.datetime] = rest_field( + name="startDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + last_modified_date_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation finished.""" + started_by: Optional[Union[str, "_models.PatchOperationStartedBy"]] = rest_field( + name="startedBy", visibility=["read"] + ) + """Indicates if operation was triggered by user or by platform. Known values are: \"User\" and + \"Platform\".""" + patch_service_used: Optional[Union[str, "_models.PatchServiceUsed"]] = rest_field( + name="patchServiceUsed", visibility=["read"] + ) + """Specifies the patch service used for the operation. Known values are: \"Unknown\", \"WU\", + \"WU_WSUS\", \"YUM\", \"APT\", and \"Zypper\".""" + os_type: Optional[Union[str, "_models.OsType"]] = rest_field(name="osType", visibility=["read"]) + """The operating system type of the machine. Known values are: \"Windows\" and \"Linux\".""" + error_details: Optional["_models.ErrorDetail"] = rest_field(name="errorDetails", visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + @overload + def __init__( + self, + *, + available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = 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 MachineExtension(TrackedResource): + """Describes a Machine Extension. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Describes Machine Extension Properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionProperties + """ + + properties: Optional["_models.MachineExtensionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes Machine Extension Properties.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.MachineExtensionProperties"] = 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 MachineExtensionInstanceView(_Model): + """Describes the Machine Extension Instance View. + + :ivar name: The machine extension name. + :vartype name: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar status: Instance view status. + :vartype status: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceViewStatus + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The machine extension name.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + status: Optional["_models.MachineExtensionInstanceViewStatus"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Instance view status.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + status: Optional["_models.MachineExtensionInstanceViewStatus"] = 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 MachineExtensionInstanceViewStatus(_Model): + """Instance view status. + + :ivar code: The status code. + :vartype code: str + :ivar level: The level code. Known values are: "Info", "Warning", and "Error". + :vartype level: str or ~azure.mgmt.hybridcompute.models.StatusLevelTypes + :ivar display_status: The short localizable label for the status. + :vartype display_status: str + :ivar message: The detailed status message, including for alerts and error messages. + :vartype message: str + :ivar time: The time of the status. + :vartype time: ~datetime.datetime + """ + + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status code.""" + level: Optional[Union[str, "_models.StatusLevelTypes"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The level code. Known values are: \"Info\", \"Warning\", and \"Error\".""" + display_status: Optional[str] = rest_field( + name="displayStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """The short localizable label for the status.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The detailed status message, including for alerts and error messages.""" + time: Optional[datetime.datetime] = rest_field( + visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The time of the status.""" + + @overload + def __init__( + self, + *, + code: Optional[str] = None, + level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, + display_status: Optional[str] = None, + message: Optional[str] = None, + time: 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 MachineExtensionProperties(_Model): + """Describes the properties of a Machine Extension. + + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: dict[str, any] + :ivar protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :vartype protected_settings: dict[str, any] + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The machine extension instance view. + :vartype instance_view: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView + """ + + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """How the extension handler should be forced to update even if the extension configuration has + not changed.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should be automatically upgraded by the platform if there is a + newer version available.""" + auto_upgrade_minor_version: Optional[bool] = rest_field( + name="autoUpgradeMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should use a newer minor version if one is available at + deployment time. Once deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true.""" + settings: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[dict[str, Any]] = rest_field( + name="protectedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no + protected settings at all.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.MachineExtensionInstanceView"] = rest_field( + name="instanceView", visibility=["read", "create", "update", "delete", "query"] + ) + """The machine extension instance view.""" + + @overload + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[dict[str, Any]] = None, + protected_settings: Optional[dict[str, Any]] = None, + instance_view: Optional["_models.MachineExtensionInstanceView"] = 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 MachineExtensionUpdate(ResourceUpdate): + """Describes a Machine Extension Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: Describes Machine Extension Update Properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdateProperties + """ + + properties: Optional["_models.MachineExtensionUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes Machine Extension Update Properties.""" + + __flattened_items = [ + "force_update_tag", + "publisher", + "type", + "type_handler_version", + "enable_automatic_upgrade", + "auto_upgrade_minor_version", + "settings", + "protected_settings", + ] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.MachineExtensionUpdateProperties"] = 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 MachineExtensionUpdateProperties(_Model): + """Describes the properties of a Machine Extension. + + :ivar force_update_tag: How the extension handler should be forced to update even if the + extension configuration has not changed. + :vartype force_update_tag: str + :ivar publisher: The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version available. + :vartype enable_automatic_upgrade: bool + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: dict[str, any] + :ivar protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :vartype protected_settings: dict[str, any] + """ + + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """How the extension handler should be forced to update even if the extension configuration has + not changed.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\".""" + type_handler_version: Optional[str] = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should be automatically upgraded by the platform if there is a + newer version available.""" + auto_upgrade_minor_version: Optional[bool] = rest_field( + name="autoUpgradeMinorVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the extension should use a newer minor version if one is available at + deployment time. Once deployed, however, the extension will not upgrade minor versions unless + redeployed, even with this property set to true.""" + settings: Optional[dict[str, Any]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[dict[str, Any]] = rest_field( + name="protectedSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no + protected settings at all.""" + + @overload + def __init__( + self, + *, + force_update_tag: Optional[str] = None, + publisher: Optional[str] = None, + type: Optional[str] = None, + type_handler_version: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[dict[str, Any]] = None, + protected_settings: Optional[dict[str, Any]] = 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 MachineExtensionUpgrade(_Model): + """Describes the Machine Extension Upgrade Properties. + + :ivar extension_targets: Describes the Extension Target Properties. + :vartype extension_targets: dict[str, + ~azure.mgmt.hybridcompute.models.ExtensionTargetProperties] + """ + + extension_targets: Optional[dict[str, "_models.ExtensionTargetProperties"]] = rest_field( + name="extensionTargets", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the Extension Target Properties.""" + + @overload + def __init__( + self, + *, + extension_targets: Optional[dict[str, "_models.ExtensionTargetProperties"]] = 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 MachineInstallPatchesParameters(_Model): + """Input for InstallPatches as directly received by the API. + + :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It + must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. + :vartype maximum_duration: ~datetime.timedelta + :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update + operation. Required. Known values are: "IfRequired", "Never", and "Always". + :vartype reboot_setting: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting + :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the + API. + :vartype windows_parameters: ~azure.mgmt.hybridcompute.models.WindowsParameters + :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the + API. + :vartype linux_parameters: ~azure.mgmt.hybridcompute.models.LinuxParameters + """ + + maximum_duration: datetime.timedelta = rest_field( + name="maximumDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the maximum amount of time that the operation will run. It must be an ISO + 8601-compliant duration string such as PT4H (4 hours). Required.""" + reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"] = rest_field( + name="rebootSetting", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines when it is acceptable to reboot a VM during a software update operation. Required. + Known values are: \"IfRequired\", \"Never\", and \"Always\".""" + windows_parameters: Optional["_models.WindowsParameters"] = rest_field( + name="windowsParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Input for InstallPatches on a Windows VM, as directly received by the API.""" + linux_parameters: Optional["_models.LinuxParameters"] = rest_field( + name="linuxParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """Input for InstallPatches on a Linux VM, as directly received by the API.""" + + @overload + def __init__( + self, + *, + maximum_duration: datetime.timedelta, + reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], + windows_parameters: Optional["_models.WindowsParameters"] = None, + linux_parameters: Optional["_models.LinuxParameters"] = 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 MachineInstallPatchesResult(_Model): + """The result summary of an installation operation. + + :ivar status: The overall success or failure status of the operation. It remains "InProgress" + until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or + "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and + "CompletedWithWarnings". + :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus + :ivar installation_activity_id: The activity ID of the operation that produced this result. + :vartype installation_activity_id: str + :ivar reboot_status: The reboot state of the VM following completion of the operation. Known + values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". + :vartype reboot_status: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootStatus + :ivar maintenance_window_exceeded: Whether the operation ran out of time before it completed + all its intended actions. + :vartype maintenance_window_exceeded: bool + :ivar excluded_patch_count: The number of patches that were not installed due to the user + blocking their installation. + :vartype excluded_patch_count: int + :ivar not_selected_patch_count: The number of patches that were detected as available for + install, but did not meet the operation's criteria. + :vartype not_selected_patch_count: int + :ivar pending_patch_count: The number of patches that were identified as meeting the + installation criteria, but were not able to be installed. Typically this happens when + maintenanceWindowExceeded == true. + :vartype pending_patch_count: int + :ivar installed_patch_count: The number of patches successfully installed. + :vartype installed_patch_count: int + :ivar failed_patch_count: The number of patches that could not be installed due to some issue. + See errors for details. + :vartype failed_patch_count: int + :ivar start_date_time: The UTC timestamp when the operation began. + :vartype start_date_time: ~datetime.datetime + :ivar last_modified_date_time: The UTC timestamp when the operation finished. + :vartype last_modified_date_time: ~datetime.datetime + :ivar started_by: Indicates if operation was triggered by user or by platform. Known values + are: "User" and "Platform". + :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy + :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: + "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". + :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed + :ivar os_type: The operating system type of the machine. Known values are: "Windows" and + "Linux". + :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType + :ivar error_details: The errors that were encountered during execution of the operation. The + details array contains the list of them. + :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail + """ + + status: Optional[Union[str, "_models.PatchOperationStatus"]] = rest_field(visibility=["read"]) + """The overall success or failure status of the operation. It remains \"InProgress\" until the + operation completes. At that point it will become \"Failed\", \"Succeeded\", \"Unknown\" or + \"CompletedWithWarnings.\". Known values are: \"Unknown\", \"InProgress\", \"Failed\", + \"Succeeded\", and \"CompletedWithWarnings\".""" + installation_activity_id: Optional[str] = rest_field(name="installationActivityId", visibility=["read"]) + """The activity ID of the operation that produced this result.""" + reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = rest_field( + name="rebootStatus", visibility=["read"] + ) + """The reboot state of the VM following completion of the operation. Known values are: + \"Unknown\", \"NotNeeded\", \"Required\", \"Started\", \"Failed\", and \"Completed\".""" + maintenance_window_exceeded: Optional[bool] = rest_field(name="maintenanceWindowExceeded", visibility=["read"]) + """Whether the operation ran out of time before it completed all its intended actions.""" + excluded_patch_count: Optional[int] = rest_field(name="excludedPatchCount", visibility=["read"]) + """The number of patches that were not installed due to the user blocking their installation.""" + not_selected_patch_count: Optional[int] = rest_field(name="notSelectedPatchCount", visibility=["read"]) + """The number of patches that were detected as available for install, but did not meet the + operation's criteria.""" + pending_patch_count: Optional[int] = rest_field(name="pendingPatchCount", visibility=["read"]) + """The number of patches that were identified as meeting the installation criteria, but were not + able to be installed. Typically this happens when maintenanceWindowExceeded == true.""" + installed_patch_count: Optional[int] = rest_field(name="installedPatchCount", visibility=["read"]) + """The number of patches successfully installed.""" + failed_patch_count: Optional[int] = rest_field(name="failedPatchCount", visibility=["read"]) + """The number of patches that could not be installed due to some issue. See errors for details.""" + start_date_time: Optional[datetime.datetime] = rest_field( + name="startDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation began.""" + last_modified_date_time: Optional[datetime.datetime] = rest_field( + name="lastModifiedDateTime", visibility=["read"], format="rfc3339" + ) + """The UTC timestamp when the operation finished.""" + started_by: Optional[Union[str, "_models.PatchOperationStartedBy"]] = rest_field( + name="startedBy", visibility=["read"] + ) + """Indicates if operation was triggered by user or by platform. Known values are: \"User\" and + \"Platform\".""" + patch_service_used: Optional[Union[str, "_models.PatchServiceUsed"]] = rest_field( + name="patchServiceUsed", visibility=["read"] + ) + """Specifies the patch service used for the operation. Known values are: \"Unknown\", \"WU\", + \"WU_WSUS\", \"YUM\", \"APT\", and \"Zypper\".""" + os_type: Optional[Union[str, "_models.OsType"]] = rest_field(name="osType", visibility=["read"]) + """The operating system type of the machine. Known values are: \"Windows\" and \"Linux\".""" + error_details: Optional["_models.ErrorDetail"] = rest_field(name="errorDetails", visibility=["read"]) + """The errors that were encountered during execution of the operation. The details array contains + the list of them.""" + + +class MachineProperties(_Model): + """Describes the properties of a hybrid machine. + + :ivar location_data: Metadata pertaining to the geographic location of the resource. + :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData + :ivar agent_configuration: Configurable properties that the user can set locally via the + azcmagent config command, or remotely via ARM. + :vartype agent_configuration: ~azure.mgmt.hybridcompute.models.AgentConfiguration + :ivar service_statuses: Statuses of dependent services that are reported back to ARM. + :vartype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses + :ivar hardware_profile: Information about the machine's hardware. + :vartype hardware_profile: ~azure.mgmt.hybridcompute.models.HardwareProfile + :ivar storage_profile: Information about the machine's storage. + :vartype storage_profile: ~azure.mgmt.hybridcompute.models.StorageProfile + :ivar firmware_profile: Information about the machine's firmware. + :vartype firmware_profile: ~azure.mgmt.hybridcompute.models.FirmwareProfile + :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade + :ivar os_profile: Specifies the operating system settings for the hybrid machine. + :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile + :ivar license_profile: Specifies the License related properties for a machine. + :vartype license_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar status: The status of the hybrid machine agent. Known values are: "Connected", + "Disconnected", "Error", and "AwaitingConnection". + :vartype status: str or ~azure.mgmt.hybridcompute.models.StatusTypes + :ivar last_status_change: The time of the last status change. + :vartype last_status_change: ~datetime.datetime + :ivar error_details: Details about the error state. + :vartype error_details: list[~azure.mgmt.hybridcompute.models.ErrorDetail] + :ivar agent_version: The hybrid machine agent full version. + :vartype agent_version: str + :ivar vm_id: Specifies the hybrid machine unique ID. + :vartype vm_id: str + :ivar display_name: Specifies the hybrid machine display name. + :vartype display_name: str + :ivar machine_fqdn: Specifies the hybrid machine FQDN. + :vartype machine_fqdn: str + :ivar client_public_key: Public Key that the client provides to be used during initial resource + onboarding. + :vartype client_public_key: str + :ivar identity_key_store: Specifies the identity key store a machine is using. Known values + are: "TPM" and "Default". + :vartype identity_key_store: str or ~azure.mgmt.hybridcompute.models.IdentityKeyStore + :ivar tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) that + the client provides to be used during initial resource onboarding. + :vartype tpm_ek_certificate: str + :ivar os_name: The Operating System running on the hybrid machine. + :vartype os_name: str + :ivar os_version: The version of Operating System running on the hybrid machine. + :vartype os_version: str + :ivar os_type: The type of Operating System (windows/linux). + :vartype os_type: str + :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. + :vartype vm_uuid: str + :ivar extensions: Machine Extensions information (deprecated field). + :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] + :ivar os_sku: Specifies the Operating System product SKU. + :vartype os_sku: str + :ivar os_edition: The edition of the Operating System. + :vartype os_edition: str + :ivar domain_name: Specifies the Windows domain name. + :vartype domain_name: str + :ivar ad_fqdn: Specifies the AD fully qualified display name. + :vartype ad_fqdn: str + :ivar dns_fqdn: Specifies the DNS fully qualified display name. + :vartype dns_fqdn: str + :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is + assigned to, if any. + :vartype private_link_scope_resource_id: str + :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this + machine is assigned to, if any. + :vartype parent_cluster_resource_id: str + :ivar hardware_resource_id: Specifies the resource ID of the associated hardware device. Only + settable by HCI RP. + :vartype hardware_resource_id: str + :ivar mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. + :vartype mssql_discovered: str + :ivar detected_properties: Detected properties from the machine. + :vartype detected_properties: dict[str, str] + :ivar network_profile: Information about the network the machine is on. + :vartype network_profile: ~azure.mgmt.hybridcompute.models.NetworkProfile + """ + + location_data: Optional["_models.LocationData"] = rest_field( + name="locationData", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata pertaining to the geographic location of the resource.""" + agent_configuration: Optional["_models.AgentConfiguration"] = rest_field( + name="agentConfiguration", visibility=["read"] + ) + """Configurable properties that the user can set locally via the azcmagent config command, or + remotely via ARM.""" + service_statuses: Optional["_models.ServiceStatuses"] = rest_field( + name="serviceStatuses", visibility=["read", "create", "update", "delete", "query"] + ) + """Statuses of dependent services that are reported back to ARM.""" + hardware_profile: Optional["_models.HardwareProfile"] = rest_field(name="hardwareProfile", visibility=["read"]) + """Information about the machine's hardware.""" + storage_profile: Optional["_models.StorageProfile"] = rest_field(name="storageProfile", visibility=["read"]) + """Information about the machine's storage.""" + firmware_profile: Optional["_models.FirmwareProfile"] = rest_field(name="firmwareProfile", visibility=["read"]) + """Information about the machine's firmware.""" + cloud_metadata: Optional["_models.CloudMetadata"] = rest_field( + name="cloudMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """The metadata of the cloud environment (Azure/GCP/AWS/OCI...).""" + agent_upgrade: Optional["_models.AgentUpgrade"] = rest_field( + name="agentUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """The info of the machine w.r.t Agent Upgrade.""" + os_profile: Optional["_models.OSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the operating system settings for the hybrid machine.""" + license_profile: Optional["_models.LicenseProfileMachineInstanceView"] = rest_field( + name="licenseProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the License related properties for a machine.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + status: Optional[Union[str, "_models.StatusTypes"]] = rest_field(visibility=["read"]) + """The status of the hybrid machine agent. Known values are: \"Connected\", \"Disconnected\", + \"Error\", and \"AwaitingConnection\".""" + last_status_change: Optional[datetime.datetime] = rest_field( + name="lastStatusChange", visibility=["read"], format="rfc3339" + ) + """The time of the last status change.""" + error_details: Optional[list["_models.ErrorDetail"]] = rest_field(name="errorDetails", visibility=["read"]) + """Details about the error state.""" + agent_version: Optional[str] = rest_field(name="agentVersion", visibility=["read"]) + """The hybrid machine agent full version.""" + vm_id: Optional[str] = rest_field(name="vmId", visibility=["read", "create"]) + """Specifies the hybrid machine unique ID.""" + display_name: Optional[str] = rest_field(name="displayName", visibility=["read"]) + """Specifies the hybrid machine display name.""" + machine_fqdn: Optional[str] = rest_field(name="machineFqdn", visibility=["read"]) + """Specifies the hybrid machine FQDN.""" + client_public_key: Optional[str] = rest_field( + name="clientPublicKey", visibility=["read", "create", "update", "delete", "query"] + ) + """Public Key that the client provides to be used during initial resource onboarding.""" + identity_key_store: Optional[Union[str, "_models.IdentityKeyStore"]] = rest_field( + name="identityKeyStore", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the identity key store a machine is using. Known values are: \"TPM\" and \"Default\".""" + tpm_ek_certificate: Optional[str] = rest_field( + name="tpmEkCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Endorsement Key Certificate of the Trusted Platform Module (TPM) that the client provides to be + used during initial resource onboarding.""" + os_name: Optional[str] = rest_field(name="osName", visibility=["read"]) + """The Operating System running on the hybrid machine.""" + os_version: Optional[str] = rest_field(name="osVersion", visibility=["read"]) + """The version of Operating System running on the hybrid machine.""" + os_type: Optional[str] = rest_field(name="osType", visibility=["read", "create", "update", "delete", "query"]) + """The type of Operating System (windows/linux).""" + vm_uuid: Optional[str] = rest_field(name="vmUuid", visibility=["read"]) + """Specifies the Arc Machine's unique SMBIOS ID.""" + extensions: Optional[list["_models.MachineExtensionInstanceView"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Machine Extensions information (deprecated field).""" + os_sku: Optional[str] = rest_field(name="osSku", visibility=["read"]) + """Specifies the Operating System product SKU.""" + os_edition: Optional[str] = rest_field(name="osEdition", visibility=["read"]) + """The edition of the Operating System.""" + domain_name: Optional[str] = rest_field(name="domainName", visibility=["read"]) + """Specifies the Windows domain name.""" + ad_fqdn: Optional[str] = rest_field(name="adFqdn", visibility=["read"]) + """Specifies the AD fully qualified display name.""" + dns_fqdn: Optional[str] = rest_field(name="dnsFqdn", visibility=["read"]) + """Specifies the DNS fully qualified display name.""" + private_link_scope_resource_id: Optional[str] = rest_field( + name="privateLinkScopeResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the private link scope this machine is assigned to, if any.""" + parent_cluster_resource_id: Optional[str] = rest_field( + name="parentClusterResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.""" + hardware_resource_id: Optional[str] = rest_field( + name="hardwareResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the resource ID of the associated hardware device. Only settable by HCI RP.""" + mssql_discovered: Optional[str] = rest_field( + name="mssqlDiscovered", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether any MS SQL instance is discovered on the machine.""" + detected_properties: Optional[dict[str, str]] = rest_field(name="detectedProperties", visibility=["read"]) + """Detected properties from the machine.""" + network_profile: Optional["_models.NetworkProfile"] = rest_field(name="networkProfile", visibility=["read"]) + """Information about the network the machine is on.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + location_data: Optional["_models.LocationData"] = None, + service_statuses: Optional["_models.ServiceStatuses"] = None, + cloud_metadata: Optional["_models.CloudMetadata"] = None, + agent_upgrade: Optional["_models.AgentUpgrade"] = None, + os_profile: Optional["_models.OSProfile"] = None, + license_profile: Optional["_models.LicenseProfileMachineInstanceView"] = None, + vm_id: Optional[str] = None, + client_public_key: Optional[str] = None, + identity_key_store: Optional[Union[str, "_models.IdentityKeyStore"]] = None, + tpm_ek_certificate: Optional[str] = None, + os_type: Optional[str] = None, + extensions: Optional[list["_models.MachineExtensionInstanceView"]] = None, + private_link_scope_resource_id: Optional[str] = None, + parent_cluster_resource_id: Optional[str] = None, + hardware_resource_id: Optional[str] = None, + mssql_discovered: 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 MachineRunCommand(TrackedResource): + """Describes a Run Command. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.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: Describes Run Command Properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.MachineRunCommandProperties + """ + + properties: Optional["_models.MachineRunCommandProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes Run Command Properties.""" + + __flattened_items = [ + "source", + "parameters", + "protected_parameters", + "async_execution", + "run_as_user", + "run_as_password", + "timeout_in_seconds", + "output_blob_uri", + "error_blob_uri", + "output_blob_managed_identity", + "error_blob_managed_identity", + "provisioning_state", + "instance_view", + ] + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[dict[str, str]] = None, + properties: Optional["_models.MachineRunCommandProperties"] = 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 MachineRunCommandInstanceView(_Model): + """The instance view of a machine run command. + + :ivar execution_state: Script execution status. Known values are: "Unknown", "Pending", + "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". + :vartype execution_state: str or ~azure.mgmt.hybridcompute.models.ExecutionState + :ivar execution_message: Communicate script configuration errors or execution messages. + :vartype execution_message: str + :ivar exit_code: Exit code returned from script execution. + :vartype exit_code: int + :ivar output: Script output stream. + :vartype output: str + :ivar error: Script error stream. + :vartype error: str + :ivar start_time: Script start time. + :vartype start_time: ~datetime.datetime + :ivar end_time: Script end time. + :vartype end_time: ~datetime.datetime + :ivar statuses: The status information. + :vartype statuses: list[~azure.mgmt.hybridcompute.models.ExtensionsResourceStatus] + """ + + execution_state: Optional[Union[str, "_models.ExecutionState"]] = rest_field( + name="executionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Script execution status. Known values are: \"Unknown\", \"Pending\", \"Running\", \"Failed\", + \"Succeeded\", \"TimedOut\", and \"Canceled\".""" + execution_message: Optional[str] = rest_field( + name="executionMessage", visibility=["read", "create", "update", "delete", "query"] + ) + """Communicate script configuration errors or execution messages.""" + exit_code: Optional[int] = rest_field(name="exitCode", visibility=["read", "create", "update", "delete", "query"]) + """Exit code returned from script execution.""" + output: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Script output stream.""" + error: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Script error stream.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Script start time.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """Script end time.""" + statuses: Optional[list["_models.ExtensionsResourceStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The status information.""" + + @overload + def __init__( + self, + *, + execution_state: Optional[Union[str, "_models.ExecutionState"]] = None, + execution_message: Optional[str] = None, + exit_code: Optional[int] = None, + output: Optional[str] = None, + error: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + statuses: Optional[list["_models.ExtensionsResourceStatus"]] = 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 MachineRunCommandProperties(_Model): + """Describes the properties of a run command. + + :ivar source: The source of the run command script. + :vartype source: ~azure.mgmt.hybridcompute.models.MachineRunCommandScriptSource + :ivar parameters: The parameters used by the script. + :vartype parameters: list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] + :ivar protected_parameters: The parameters used by the script. + :vartype protected_parameters: list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] + :ivar async_execution: Optional. If set to true, provisioning will complete as soon as script + starts and will not wait for script to complete. + :vartype async_execution: bool + :ivar run_as_user: Specifies the user account on the machine when executing the run command. + :vartype run_as_user: str + :ivar run_as_password: Specifies the user account password on the machine when executing the + run command. + :vartype run_as_password: str + :ivar timeout_in_seconds: The timeout in seconds to execute the run command. + :vartype timeout_in_seconds: int + :ivar output_blob_uri: Specifies the Azure storage blob where script output stream will be + uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to + provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. + :vartype output_blob_uri: str + :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be + uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to + provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. + :vartype error_blob_uri: str + :ivar output_blob_managed_identity: User-assigned managed identity that has access to + outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure + managed identity has been given access to blob's container with 'Storage Blob Data Contributor' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_. + :vartype output_blob_managed_identity: + ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity + :ivar error_blob_managed_identity: User-assigned managed identity that has access to + errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure + managed identity has been given access to blob's container with 'Storage Blob Data Contributor' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_. + :vartype error_blob_managed_identity: + ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + :ivar instance_view: The machine run command instance view. + :vartype instance_view: ~azure.mgmt.hybridcompute.models.MachineRunCommandInstanceView + """ + + source: Optional["_models.MachineRunCommandScriptSource"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The source of the run command script.""" + parameters: Optional[list["_models.RunCommandInputParameter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used by the script.""" + protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = rest_field( + name="protectedParameters", visibility=["read", "create", "update", "delete", "query"] + ) + """The parameters used by the script.""" + async_execution: Optional[bool] = rest_field( + name="asyncExecution", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional. If set to true, provisioning will complete as soon as script starts and will not wait + for script to complete.""" + run_as_user: Optional[str] = rest_field( + name="runAsUser", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the user account on the machine when executing the run command.""" + run_as_password: Optional[str] = rest_field( + name="runAsPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the user account password on the machine when executing the run command.""" + timeout_in_seconds: Optional[int] = rest_field( + name="timeoutInSeconds", visibility=["read", "create", "update", "delete", "query"] + ) + """The timeout in seconds to execute the run command.""" + output_blob_uri: Optional[str] = rest_field( + name="outputBlobUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Azure storage blob where script output stream will be uploaded. Use a SAS URI + with read, append, create, write access OR use managed identity to provide the VM access to the + blob. Refer outputBlobManagedIdentity parameter.""" + error_blob_uri: Optional[str] = rest_field( + name="errorBlobUri", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the Azure storage blob where script error stream will be uploaded. Use a SAS URI with + read, append, create, write access OR use managed identity to provide the VM access to the + blob. Refer errorBlobManagedIdentity parameter.""" + output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="outputBlobManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to outputBlobUri storage blob. Use an empty + object in case of system-assigned identity. Make sure managed identity has been given access to + blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned + identity, make sure you add it under VM's identity. For more info on managed identity and Run + Command, refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_.""" + error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="errorBlobManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to errorBlobUri storage blob. Use an empty + object in case of system-assigned identity. Make sure managed identity has been given access to + blob's container with 'Storage Blob Data Contributor' role assignment. In case of user-assigned + identity, make sure you add it under VM's identity. For more info on managed identity and Run + Command, refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + instance_view: Optional["_models.MachineRunCommandInstanceView"] = rest_field( + name="instanceView", visibility=["read"] + ) + """The machine run command instance view.""" + + @overload + def __init__( + self, + *, + source: Optional["_models.MachineRunCommandScriptSource"] = None, + parameters: Optional[list["_models.RunCommandInputParameter"]] = None, + protected_parameters: Optional[list["_models.RunCommandInputParameter"]] = None, + async_execution: Optional[bool] = None, + run_as_user: Optional[str] = None, + run_as_password: Optional[str] = None, + timeout_in_seconds: Optional[int] = None, + output_blob_uri: Optional[str] = None, + error_blob_uri: Optional[str] = None, + output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, + error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = 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 MachineRunCommandScriptSource(_Model): + """Describes the script sources for run command. Use only one of script, scriptUri, commandId. + + :ivar script: Specifies the script content to be executed on the machine. + :vartype script: str + :ivar script_uri: Specifies the script download location. It can be either SAS URI of an Azure + storage blob with read access or public URI. + :vartype script_uri: str + :ivar command_id: Specifies the commandId of predefined built-in script. + :vartype command_id: str + :ivar script_uri_managed_identity: User-assigned managed identity that has access to scriptUri + in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make + sure the Azure storage blob exists, and managed identity has been given access to blob's + container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, + make sure you add it under VM's identity. For more info on managed identity and Run Command, + refer `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_. + :vartype script_uri_managed_identity: + ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity + """ + + script: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the script content to be executed on the machine.""" + script_uri: Optional[str] = rest_field(name="scriptUri", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the script download location. It can be either SAS URI of an Azure storage blob with + read access or public URI.""" + command_id: Optional[str] = rest_field(name="commandId", visibility=["read", "create", "update", "delete", "query"]) + """Specifies the commandId of predefined built-in script.""" + script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = rest_field( + name="scriptUriManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """User-assigned managed identity that has access to scriptUri in case of Azure storage blob. Use + an empty object in case of system-assigned identity. Make sure the Azure storage blob exists, + and managed identity has been given access to blob's container with 'Storage Blob Data Reader' + role assignment. In case of user-assigned identity, make sure you add it under VM's identity. + For more info on managed identity and Run Command, refer `https://aka.ms/ManagedIdentity + `_ and `https://aka.ms/RunCommandManaged + `_.""" + + @overload + def __init__( + self, + *, + script: Optional[str] = None, + script_uri: Optional[str] = None, + command_id: Optional[str] = None, + script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = 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 MachineUpdate(ResourceUpdate): + """Describes a hybrid machine Update. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Identity for the resource. + :vartype identity: ~azure.mgmt.hybridcompute.models.Identity + :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or + VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". + :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum + :ivar properties: Hybrid Compute Machine properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.MachineUpdateProperties + """ + + identity: Optional["_models.Identity"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Identity for the resource.""" + kind: Optional[Union[str, "_models.ArcKindEnum"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or VMware etc. + Known values are: \"AVS\", \"HCI\", \"SCVMM\", \"VMware\", \"EPS\", \"GCP\", and \"AWS\".""" + properties: Optional["_models.MachineUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Hybrid Compute Machine properties.""" + + __flattened_items = [ + "location_data", + "os_profile", + "cloud_metadata", + "agent_upgrade", + "parent_cluster_resource_id", + "private_link_scope_resource_id", + "identity_key_store", + "tpm_ek_certificate", + ] + + @overload + def __init__( + self, + *, + tags: Optional[dict[str, str]] = None, + identity: Optional["_models.Identity"] = None, + kind: Optional[Union[str, "_models.ArcKindEnum"]] = None, + properties: Optional["_models.MachineUpdateProperties"] = 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 MachineUpdateProperties(_Model): + """Describes the ARM updatable properties of a hybrid machine. + + :ivar location_data: Metadata pertaining to the geographic location of the resource. + :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData + :ivar os_profile: Specifies the operating system settings for the hybrid machine. + :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile + :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). + :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata + :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. + :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade + :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this + machine is assigned to, if any. + :vartype parent_cluster_resource_id: str + :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is + assigned to, if any. + :vartype private_link_scope_resource_id: str + :ivar identity_key_store: Identity key store type of the machine. + :vartype identity_key_store: str + :ivar tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) that + the client provides to be used during initial resource onboarding. + :vartype tpm_ek_certificate: str + """ + + location_data: Optional["_models.LocationData"] = rest_field( + name="locationData", visibility=["read", "create", "update", "delete", "query"] + ) + """Metadata pertaining to the geographic location of the resource.""" + os_profile: Optional["_models.OSProfile"] = rest_field( + name="osProfile", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the operating system settings for the hybrid machine.""" + cloud_metadata: Optional["_models.CloudMetadata"] = rest_field( + name="cloudMetadata", visibility=["read", "create", "update", "delete", "query"] + ) + """The metadata of the cloud environment (Azure/GCP/AWS/OCI...).""" + agent_upgrade: Optional["_models.AgentUpgrade"] = rest_field( + name="agentUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """The info of the machine w.r.t Agent Upgrade.""" + parent_cluster_resource_id: Optional[str] = rest_field( + name="parentClusterResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the parent cluster (Azure HCI) this machine is assigned to, if any.""" + private_link_scope_resource_id: Optional[str] = rest_field( + name="privateLinkScopeResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource id of the private link scope this machine is assigned to, if any.""" + identity_key_store: Optional[str] = rest_field( + name="identityKeyStore", visibility=["read", "create", "update", "delete", "query"] + ) + """Identity key store type of the machine.""" + tpm_ek_certificate: Optional[str] = rest_field( + name="tpmEkCertificate", visibility=["read", "create", "update", "delete", "query"] + ) + """Endorsement Key Certificate of the Trusted Platform Module (TPM) that the client provides to be + used during initial resource onboarding.""" + + @overload + def __init__( + self, + *, + location_data: Optional["_models.LocationData"] = None, + os_profile: Optional["_models.OSProfile"] = None, + cloud_metadata: Optional["_models.CloudMetadata"] = None, + agent_upgrade: Optional["_models.AgentUpgrade"] = None, + parent_cluster_resource_id: Optional[str] = None, + private_link_scope_resource_id: Optional[str] = None, + identity_key_store: Optional[str] = None, + tpm_ek_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 NetworkInterface(_Model): + """Describes a network interface. + + :ivar mac_address: Represents MAC address of the network interface. + :vartype mac_address: str + :ivar id: Represents the ID of the network interface. + :vartype id: str + :ivar name: Represents the name of the network interface. + :vartype name: str + :ivar ip_addresses: The list of IP addresses in this interface. + :vartype ip_addresses: list[~azure.mgmt.hybridcompute.models.IpAddress] + """ + + mac_address: Optional[str] = rest_field( + name="macAddress", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents MAC address of the network interface.""" + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Represents the ID of the network interface.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Represents the name of the network interface.""" + ip_addresses: Optional[list["_models.IpAddress"]] = rest_field(name="ipAddresses", visibility=["read"]) + """The list of IP addresses in this interface.""" + + @overload + def __init__( + self, + *, + mac_address: Optional[str] = None, + id: Optional[str] = None, # pylint: disable=redefined-builtin + 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 NetworkProfile(_Model): + """Describes the network information on this machine. + + :ivar network_interfaces: The list of network interfaces. + :vartype network_interfaces: list[~azure.mgmt.hybridcompute.models.NetworkInterface] + """ + + network_interfaces: Optional[list["_models.NetworkInterface"]] = rest_field( + name="networkInterfaces", visibility=["read"] + ) + """The list of network interfaces.""" + + +class NetworkSecurityPerimeter(_Model): + """Properties that define a Network Security Perimeter resource. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar perimeter_guid: Guid of the Network Security Perimeter. + :vartype perimeter_guid: str + :ivar location: Regional location of the perimeter. + :vartype location: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Azure resource Id.""" + perimeter_guid: Optional[str] = rest_field(name="perimeterGuid", visibility=["read"]) + """Guid of the Network Security Perimeter.""" + location: Optional[str] = rest_field(visibility=["read"]) + """Regional location of the perimeter.""" + + +class NetworkSecurityPerimeterConfiguration(ProxyResource): + """Properties that define a Network Security Perimeter 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 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.hybridcompute.models.SystemData + :ivar properties: Properties that define a Network Security Perimeter resource. + :vartype properties: + ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationProperties + """ + + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Properties that define a Network Security Perimeter resource.""" + + __flattened_items = [ + "provisioning_state", + "provisioning_issues", + "network_security_perimeter", + "resource_association", + "profile", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.NetworkSecurityPerimeterConfigurationProperties"] = 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 NetworkSecurityPerimeterConfigurationProperties(_Model): # pylint: disable=name-too-long + """Properties that define a Network Security Perimeter resource. + + :ivar provisioning_state: Current state of this NetworkSecurityPerimeter: whether or not is has + been provisioned within the resource group it is defined. Users cannot change this value but + are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. + :vartype provisioning_state: str + :ivar provisioning_issues: Provisioning issues. + :vartype provisioning_issues: list[~azure.mgmt.hybridcompute.models.ProvisioningIssue] + :ivar network_security_perimeter: The Network Security Perimeter associated with this + configuration. + :vartype network_security_perimeter: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeter + :ivar resource_association: The Resource Association. + :vartype resource_association: ~azure.mgmt.hybridcompute.models.ResourceAssociation + :ivar profile: Network Security Perimeter profile. + :vartype profile: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterProfile + """ + + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """Current state of this NetworkSecurityPerimeter: whether or not is has been provisioned within + the resource group it is defined. Users cannot change this value but are able to read from it. + Values will include Provisioning ,Succeeded, Canceled and Failed.""" + provisioning_issues: Optional[list["_models.ProvisioningIssue"]] = rest_field( + name="provisioningIssues", visibility=["read"] + ) + """Provisioning issues.""" + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = rest_field( + name="networkSecurityPerimeter", visibility=["read", "create", "update", "delete", "query"] + ) + """The Network Security Perimeter associated with this configuration.""" + resource_association: Optional["_models.ResourceAssociation"] = rest_field( + name="resourceAssociation", visibility=["read", "create", "update", "delete", "query"] + ) + """The Resource Association.""" + profile: Optional["_models.NetworkSecurityPerimeterProfile"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Network Security Perimeter profile.""" + + @overload + def __init__( + self, + *, + network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, + resource_association: Optional["_models.ResourceAssociation"] = None, + profile: Optional["_models.NetworkSecurityPerimeterProfile"] = 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 NetworkSecurityPerimeterConfigurationReconcileResult(_Model): # pylint: disable=name-too-long + """Result of network security perimeter configurations. + + :ivar location: The URL of the resource used to check the status of the asynchronous operation. + :vartype location: str + """ + + location: Optional[str] = rest_field(visibility=["read"]) + """The URL of the resource used to check the status of the asynchronous operation.""" + + +class NetworkSecurityPerimeterProfile(_Model): + """Network Security Perimeter profile. + + :ivar name: Name of the resource. + :vartype name: str + :ivar access_rules_version: Access rules version number. + :vartype access_rules_version: int + :ivar access_rules: Collection of access rules for the profile. + :vartype access_rules: list[~azure.mgmt.hybridcompute.models.AccessRule] + :ivar diagnostic_settings_version: Diagnostic settings version number. + :vartype diagnostic_settings_version: int + :ivar enabled_log_categories: Collection of enabled log categories for the profile. + :vartype enabled_log_categories: list[str] + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the resource.""" + access_rules_version: Optional[int] = rest_field(name="accessRulesVersion", visibility=["read"]) + """Access rules version number.""" + access_rules: Optional[list["_models.AccessRule"]] = rest_field(name="accessRules", visibility=["read"]) + """Collection of access rules for the profile.""" + diagnostic_settings_version: Optional[int] = rest_field(name="diagnosticSettingsVersion", visibility=["read"]) + """Diagnostic settings version number.""" + enabled_log_categories: Optional[list[str]] = rest_field(name="enabledLogCategories", visibility=["read"]) + """Collection of enabled log categories for the profile.""" + + +class OperationValue(_Model): + """Describes the properties of a Compute Operation value. + + :ivar origin: The origin of the compute operation. + :vartype origin: str + :ivar name: The name of the compute operation. + :vartype name: str + :ivar display: Display properties. + :vartype display: ~azure.mgmt.hybridcompute.models.OperationValueDisplay + :ivar is_data_action: This property indicates if the operation is an action or a data action. + :vartype is_data_action: bool + """ + + origin: Optional[str] = rest_field(visibility=["read"]) + """The origin of the compute operation.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the compute operation.""" + display: Optional["_models.OperationValueDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Display properties.""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """This property indicates if the operation is an action or a data action.""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationValueDisplay"] = 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 OperationValueDisplay(_Model): + """Describes the properties of a Hybrid Compute Operation Value Display. + + :ivar operation: The display name of the compute operation. + :vartype operation: str + :ivar resource: The display name of the resource the operation applies to. + :vartype resource: str + :ivar description: The description of the operation. + :vartype description: str + :ivar provider: The resource provider for the operation. + :vartype provider: str + """ + + operation: Optional[str] = rest_field(visibility=["read"]) + """The display name of the compute operation.""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The display name of the resource the operation applies to.""" + description: Optional[str] = rest_field(visibility=["read"]) + """The description of the operation.""" + provider: Optional[str] = rest_field(visibility=["read"]) + """The resource provider for the operation.""" + + +class OSProfile(_Model): + """Specifies the operating system settings for the hybrid machine. + + :ivar computer_name: Specifies the host OS name of the hybrid machine. + :vartype computer_name: str + :ivar windows_configuration: Specifies the windows configuration for update management. + :vartype windows_configuration: ~azure.mgmt.hybridcompute.models.OSProfileWindowsConfiguration + :ivar linux_configuration: Specifies the linux configuration for update management. + :vartype linux_configuration: ~azure.mgmt.hybridcompute.models.OSProfileLinuxConfiguration + """ + + computer_name: Optional[str] = rest_field(name="computerName", visibility=["read"]) + """Specifies the host OS name of the hybrid machine.""" + windows_configuration: Optional["_models.OSProfileWindowsConfiguration"] = rest_field( + name="windowsConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the windows configuration for update management.""" + linux_configuration: Optional["_models.OSProfileLinuxConfiguration"] = rest_field( + name="linuxConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the linux configuration for update management.""" + + @overload + def __init__( + self, + *, + windows_configuration: Optional["_models.OSProfileWindowsConfiguration"] = None, + linux_configuration: Optional["_models.OSProfileLinuxConfiguration"] = 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 OSProfileLinuxConfiguration(_Model): + """Specifies the linux configuration for update management. + + :ivar patch_settings: Specifies the patch settings. + :vartype patch_settings: ~azure.mgmt.hybridcompute.models.PatchSettings + """ + + patch_settings: Optional["_models.PatchSettings"] = rest_field( + name="patchSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the patch settings.""" + + __flattened_items = ["assessment_mode", "patch_mode", "enable_hotpatching", "status"] + + @overload + def __init__( + self, + *, + patch_settings: Optional["_models.PatchSettings"] = 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.patch_settings is None: + return None + return getattr(self.patch_settings, 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.patch_settings is None: + self.patch_settings = self._attr_to_rest_field["patch_settings"]._class_type() + setattr(self.patch_settings, key, value) + else: + super().__setattr__(key, value) + + +class OSProfileWindowsConfiguration(_Model): + """Specifies the windows configuration for update management. + + :ivar patch_settings: Specifies the patch settings. + :vartype patch_settings: ~azure.mgmt.hybridcompute.models.PatchSettings + """ + + patch_settings: Optional["_models.PatchSettings"] = rest_field( + name="patchSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the patch settings.""" + + __flattened_items = ["assessment_mode", "patch_mode", "enable_hotpatching", "status"] + + @overload + def __init__( + self, + *, + patch_settings: Optional["_models.PatchSettings"] = 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.patch_settings is None: + return None + return getattr(self.patch_settings, 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.patch_settings is None: + self.patch_settings = self._attr_to_rest_field["patch_settings"]._class_type() + setattr(self.patch_settings, key, value) + else: + super().__setattr__(key, value) + + +class PatchSettings(_Model): + """Specifies the patch settings. + + :ivar assessment_mode: Specifies the assessment mode. Known values are: "ImageDefault" and + "AutomaticByPlatform". + :vartype assessment_mode: str or ~azure.mgmt.hybridcompute.models.AssessmentModeTypes + :ivar patch_mode: Specifies the patch mode. Known values are: "ImageDefault", + "AutomaticByPlatform", "AutomaticByOS", and "Manual". + :vartype patch_mode: str or ~azure.mgmt.hybridcompute.models.PatchModeTypes + :ivar enable_hotpatching: Captures the hotpatch capability enrollment intent of the customers, + which enables customers to patch their Windows machines without requiring a reboot. + :vartype enable_hotpatching: bool + :ivar status: Status of the hotpatch capability enrollment or disenrollment. + :vartype status: ~azure.mgmt.hybridcompute.models.PatchSettingsStatus + """ + + assessment_mode: Optional[Union[str, "_models.AssessmentModeTypes"]] = rest_field( + name="assessmentMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the assessment mode. Known values are: \"ImageDefault\" and \"AutomaticByPlatform\".""" + patch_mode: Optional[Union[str, "_models.PatchModeTypes"]] = rest_field( + name="patchMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the patch mode. Known values are: \"ImageDefault\", \"AutomaticByPlatform\", + \"AutomaticByOS\", and \"Manual\".""" + enable_hotpatching: Optional[bool] = rest_field( + name="enableHotpatching", visibility=["read", "create", "update", "delete", "query"] + ) + """Captures the hotpatch capability enrollment intent of the customers, which enables customers to + patch their Windows machines without requiring a reboot.""" + status: Optional["_models.PatchSettingsStatus"] = rest_field(visibility=["read"]) + """Status of the hotpatch capability enrollment or disenrollment.""" + + @overload + def __init__( + self, + *, + assessment_mode: Optional[Union[str, "_models.AssessmentModeTypes"]] = None, + patch_mode: Optional[Union[str, "_models.PatchModeTypes"]] = None, + enable_hotpatching: 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 PatchSettingsStatus(_Model): + """Status of the hotpatch capability enrollment or disenrollment. + + :ivar hotpatch_enablement_status: Indicates the current status of the hotpatch being enabled or + disabled. Known values are: "Unknown", "PendingEvaluation", "Disabled", "ActionRequired", and + "Enabled". + :vartype hotpatch_enablement_status: str or + ~azure.mgmt.hybridcompute.models.HotpatchEnablementStatus + :ivar error: The errors that were encountered during the hotpatch capability enrollment or + disenrollment. + :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail + """ + + hotpatch_enablement_status: Optional[Union[str, "_models.HotpatchEnablementStatus"]] = rest_field( + name="hotpatchEnablementStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the current status of the hotpatch being enabled or disabled. Known values are: + \"Unknown\", \"PendingEvaluation\", \"Disabled\", \"ActionRequired\", and \"Enabled\".""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read"]) + """The errors that were encountered during the hotpatch capability enrollment or disenrollment.""" + + @overload + def __init__( + self, + *, + hotpatch_enablement_status: Optional[Union[str, "_models.HotpatchEnablementStatus"]] = 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 PrivateEndpointConnection(ProxyResource): + """A private endpoint connection. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + @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 PrivateEndpointConnectionDataModel(_Model): + """The Data Model for a Private Endpoint Connection associated with a Private Link Scope. + + :ivar id: The ARM Resource Id of the Private Endpoint. + :vartype id: str + :ivar name: The Name of the Private Endpoint. + :vartype name: str + :ivar type: Azure resource type. + :vartype type: str + :ivar properties: The Private Endpoint Connection properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The ARM Resource Id of the Private Endpoint.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The Name of the Private Endpoint.""" + type: Optional[str] = rest_field(visibility=["read"]) + """Azure resource type.""" + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The Private Endpoint Connection properties.""" + + @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): + """Properties of a private endpoint connection. + + :ivar private_endpoint: Private endpoint which the connection belongs to. + :vartype private_endpoint: ~azure.mgmt.hybridcompute.models.PrivateEndpointProperty + :ivar private_link_service_connection_state: Connection state of the private endpoint + connection. + :vartype private_link_service_connection_state: + ~azure.mgmt.hybridcompute.models.PrivateLinkServiceConnectionStateProperty + :ivar provisioning_state: State of the private endpoint connection. + :vartype provisioning_state: str + :ivar group_ids: List of group IDs. + :vartype group_ids: list[str] + """ + + private_endpoint: Optional["_models.PrivateEndpointProperty"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """Private endpoint which the connection belongs to.""" + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """Connection state of the private endpoint connection.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """State of the private endpoint connection.""" + group_ids: Optional[list[str]] = rest_field(name="groupIds", visibility=["read"]) + """List of group IDs.""" + + @overload + def __init__( + self, + *, + private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, + private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = 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 PrivateEndpointProperty(_Model): + """Private endpoint which the connection belongs to. + + :ivar id: Resource id of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource id of the private endpoint.""" + + @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 PrivateLinkResource(ProxyResource): + """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 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.hybridcompute.models.SystemData + :ivar properties: Resource properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateLinkResourceProperties + """ + + properties: Optional["_models.PrivateLinkResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Resource properties.""" + + @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: Required DNS zone names of the the private link resource. + :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"]) + """Required DNS zone names of the the private link resource.""" + + +class PrivateLinkScopeValidationDetails(_Model): + """PrivateLinkScopeValidationDetails. + + :ivar id: Azure resource Id. + :vartype id: str + :ivar public_network_access: Indicates whether machines associated with the private link scope + can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", and + "SecuredByPerimeter". + :vartype public_network_access: str or ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType + :ivar connection_details: List of Private Endpoint Connection details. + :vartype connection_details: list[~azure.mgmt.hybridcompute.models.ConnectionDetail] + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Azure resource Id.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = rest_field( + name="publicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether machines associated with the private link scope can also use public Azure Arc + service endpoints. Known values are: \"Enabled\", \"Disabled\", and \"SecuredByPerimeter\".""" + connection_details: Optional[list["_models.ConnectionDetail"]] = rest_field( + name="connectionDetails", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Private Endpoint Connection details.""" + + @overload + def __init__( + self, + *, + public_network_access: Optional[Union[str, "_models.PublicNetworkAccessType"]] = None, + connection_details: Optional[list["_models.ConnectionDetail"]] = 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 PrivateLinkServiceConnectionStateProperty(_Model): # pylint: disable=name-too-long + """State of the private endpoint connection. + + :ivar status: The private link service connection status. Required. + :vartype status: str + :ivar description: The private link service connection description. Required. + :vartype description: str + :ivar actions_required: The actions required for private link service connection. + :vartype actions_required: str + """ + + status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection status. Required.""" + description: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The private link service connection description. Required.""" + actions_required: Optional[str] = rest_field(name="actionsRequired", visibility=["read"]) + """The actions required for private link service connection.""" + + @overload + def __init__( + self, + *, + status: str, + description: str, + ) -> 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 Processor(_Model): + """Describes the firmware of the machine. + + :ivar name: The name of the processor. + :vartype name: str + :ivar number_of_cores: The total number of physical cores on the processor. + :vartype number_of_cores: int + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the processor.""" + number_of_cores: Optional[int] = rest_field(name="numberOfCores", visibility=["read"]) + """The total number of physical cores on the processor.""" + + +class ProductFeature(_Model): + """Product Feature. + + :ivar name: Product feature name. + :vartype name: str + :ivar subscription_status: Indicates the current status of the product features. Known values + are: "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". + :vartype subscription_status: str or + ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus + :ivar enrollment_date: The timestamp in UTC when the user enrolls the feature. + :vartype enrollment_date: ~datetime.datetime + :ivar billing_start_date: The timestamp in UTC when the billing starts. + :vartype billing_start_date: ~datetime.datetime + :ivar disenrollment_date: The timestamp in UTC when the user disenrolled the feature. + :vartype disenrollment_date: ~datetime.datetime + :ivar billing_end_date: The timestamp in UTC when the billing ends. + :vartype billing_end_date: ~datetime.datetime + :ivar error: The errors that were encountered during the feature enrollment or disenrollment. + :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Product feature name.""" + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = rest_field( + name="subscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the current status of the product features. Known values are: \"Unknown\", + \"Enabling\", \"Enabled\", \"Disabled\", \"Disabling\", and \"Failed\".""" + enrollment_date: Optional[datetime.datetime] = rest_field( + name="enrollmentDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the user enrolls the feature.""" + billing_start_date: Optional[datetime.datetime] = rest_field( + name="billingStartDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the billing starts.""" + disenrollment_date: Optional[datetime.datetime] = rest_field( + name="disenrollmentDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the user disenrolled the feature.""" + billing_end_date: Optional[datetime.datetime] = rest_field( + name="billingEndDate", visibility=["read"], format="rfc3339" + ) + """The timestamp in UTC when the billing ends.""" + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read"]) + """The errors that were encountered during the feature enrollment or disenrollment.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = 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 ProductFeatureUpdate(_Model): + """Product Feature. + + :ivar name: Product feature name. + :vartype name: str + :ivar subscription_status: Indicates the new status of the product feature. Known values are: + "Enable" and "Disable". + :vartype subscription_status: str or + ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Product feature name.""" + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = rest_field( + name="subscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the new status of the product feature. Known values are: \"Enable\" and \"Disable\".""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = 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 ProductProfileUpdateProperties(_Model): + """Describes the Update properties of a Product Profile. + + :ivar subscription_status: Indicates the subscription status of the product. Known values are: + "Enable" and "Disable". + :vartype subscription_status: str or + ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate + :ivar product_type: Indicates the product type of the license. Known values are: + "WindowsServer" and "WindowsIoTEnterprise". + :vartype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType + :ivar product_features: The list of product feature updates. + :vartype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeatureUpdate] + """ + + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = rest_field( + name="subscriptionStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the subscription status of the product. Known values are: \"Enable\" and \"Disable\".""" + product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = rest_field( + name="productType", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the product type of the license. Known values are: \"WindowsServer\" and + \"WindowsIoTEnterprise\".""" + product_features: Optional[list["_models.ProductFeatureUpdate"]] = rest_field( + name="productFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of product feature updates.""" + + @overload + def __init__( + self, + *, + subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = None, + product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = None, + product_features: Optional[list["_models.ProductFeatureUpdate"]] = 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 ProvisioningIssue(_Model): + """Details on issues that occurred during provisioning. + + :ivar name: Name of the provisioning issue. + :vartype name: str + :ivar properties: Provisioning issue properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.ProvisioningIssueProperties + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the provisioning issue.""" + properties: Optional["_models.ProvisioningIssueProperties"] = rest_field(visibility=["read"]) + """Provisioning issue properties.""" + + __flattened_items = ["issue_type", "severity", "description", "suggested_resource_ids", "suggested_access_rules"] + + +class ProvisioningIssueProperties(_Model): + """Properties of a provisioning issue. + + :ivar issue_type: Issue type. Known values are: "MissingPerimeterConfiguration", + "MissingIdentityConfiguration", "ConfigurationPropagationFailure", and "Other". + :vartype issue_type: str or ~azure.mgmt.hybridcompute.models.ProvisioningIssueType + :ivar severity: Severity of the provisioning issue. Known values are: "Warning" and "Error". + :vartype severity: str or ~azure.mgmt.hybridcompute.models.ProvisioningIssueSeverity + :ivar description: Description of the provisioning issue. + :vartype description: str + :ivar suggested_resource_ids: ARM Ids of the resources that can be associated to the same + perimeter to remediate the issue. + :vartype suggested_resource_ids: list[str] + :ivar suggested_access_rules: Access rules that can be added to the perimeter to remediate the + issue. + :vartype suggested_access_rules: list[~azure.mgmt.hybridcompute.models.AccessRule] + """ + + issue_type: Optional[Union[str, "_models.ProvisioningIssueType"]] = rest_field( + name="issueType", visibility=["read"] + ) + """Issue type. Known values are: \"MissingPerimeterConfiguration\", + \"MissingIdentityConfiguration\", \"ConfigurationPropagationFailure\", and \"Other\".""" + severity: Optional[Union[str, "_models.ProvisioningIssueSeverity"]] = rest_field(visibility=["read"]) + """Severity of the provisioning issue. Known values are: \"Warning\" and \"Error\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """Description of the provisioning issue.""" + suggested_resource_ids: Optional[list[str]] = rest_field(name="suggestedResourceIds", visibility=["read"]) + """ARM Ids of the resources that can be associated to the same perimeter to remediate the issue.""" + suggested_access_rules: Optional[list["_models.AccessRule"]] = rest_field( + name="suggestedAccessRules", visibility=["read"] + ) + """Access rules that can be added to the perimeter to remediate the issue.""" + + +class ResourceAssociation(_Model): + """Properties that define a Resource Association. + + :ivar name: Name of the Resource Association. + :vartype name: str + :ivar access_mode: The access mode. Known values are: "enforced", "audit", and "learning". + :vartype access_mode: str or ~azure.mgmt.hybridcompute.models.AccessMode + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """Name of the Resource Association.""" + access_mode: Optional[Union[str, "_models.AccessMode"]] = rest_field(name="accessMode", visibility=["read"]) + """The access mode. Known values are: \"enforced\", \"audit\", and \"learning\".""" + + +class RunCommandInputParameter(_Model): + """Describes the properties of a run command parameter. + + :ivar name: The run command parameter name. Required. + :vartype name: str + :ivar value: The run command parameter value. Required. + :vartype value: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter name. Required.""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The run command parameter value. Required.""" + + @overload + def __init__( + self, + *, + name: str, + value: str, + ) -> 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 RunCommandManagedIdentity(_Model): + """Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that + has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object + in case of system-assigned identity. Make sure the Azure storage blob exists in case of + scriptUri, and managed identity has been given access to blob's container with 'Storage Blob + Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append + blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it + under VM's identity. For more info on managed identity and Run Command, refer + `https://aka.ms/ManagedIdentity `_ and + `https://aka.ms/RunCommandManaged `_. + + :ivar client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId should + not be used if this is provided. + :vartype client_id: str + :ivar object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId should + not be used if this is provided. + :vartype object_id: str + """ + + client_id: Optional[str] = rest_field(name="clientId", visibility=["read", "create", "update", "delete", "query"]) + """Client Id (GUID value) of the user-assigned managed identity. ObjectId should not be used if + this is provided.""" + object_id: Optional[str] = rest_field(name="objectId", visibility=["read", "create", "update", "delete", "query"]) + """Object Id (GUID value) of the user-assigned managed identity. ClientId should not be used if + this is provided.""" + + @overload + def __init__( + self, + *, + client_id: Optional[str] = None, + object_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 ServiceExtension(_Model): + """Enable private link validation for an Azure Arc Extension. + + :ivar service_extension_type: The name of the Azure Arc Extension. Is one of the following + types: str + :vartype service_extension_type: str + :ivar service_extension_public_network_access: The network access policy to determine if the + specified Azure Arc Extension can use public Azure Arc Extension service endpoints. Known + values are: "Enabled" and "Disabled". + :vartype service_extension_public_network_access: str or + ~azure.mgmt.hybridcompute.models.ServiceExtensionPublicNetworkAccess + """ + + service_extension_type: Optional["_types.ServiceExtensionType"] = rest_field( + name="serviceExtensionType", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the Azure Arc Extension. Is one of the following types: str""" + service_extension_public_network_access: Optional[Union[str, "_models.ServiceExtensionPublicNetworkAccess"]] = ( + rest_field( + name="serviceExtensionPublicNetworkAccess", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """The network access policy to determine if the specified Azure Arc Extension can use public + Azure Arc Extension service endpoints. Known values are: \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + service_extension_type: Optional["_types.ServiceExtensionType"] = None, + service_extension_public_network_access: Optional[ + Union[str, "_models.ServiceExtensionPublicNetworkAccess"] + ] = 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 ServiceStatus(_Model): + """Describes the status and behavior of a service. + + :ivar status: The current status of the service. + :vartype status: str + :ivar startup_type: The behavior of the service when the Arc-enabled machine starts up. + :vartype startup_type: str + """ + + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The current status of the service.""" + startup_type: Optional[str] = rest_field( + name="startupType", visibility=["read", "create", "update", "delete", "query"] + ) + """The behavior of the service when the Arc-enabled machine starts up.""" + + @overload + def __init__( + self, + *, + status: Optional[str] = None, + startup_type: 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 ServiceStatuses(_Model): + """Reports the state and behavior of dependent services. + + :ivar extension_service: The state of the extension service on the Arc-enabled machine. + :vartype extension_service: ~azure.mgmt.hybridcompute.models.ServiceStatus + :ivar guest_configuration_service: The state of the guest configuration service on the + Arc-enabled machine. + :vartype guest_configuration_service: ~azure.mgmt.hybridcompute.models.ServiceStatus + """ + + extension_service: Optional["_models.ServiceStatus"] = rest_field( + name="extensionService", visibility=["read", "create", "update", "delete", "query"] + ) + """The state of the extension service on the Arc-enabled machine.""" + guest_configuration_service: Optional["_models.ServiceStatus"] = rest_field( + name="guestConfigurationService", visibility=["read", "create", "update", "delete", "query"] + ) + """The state of the guest configuration service on the Arc-enabled machine.""" + + @overload + def __init__( + self, + *, + extension_service: Optional["_models.ServiceStatus"] = None, + guest_configuration_service: Optional["_models.ServiceStatus"] = 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 Settings(ProxyResource): + """Concrete proxy resource types can be created by aliasing this type using a specific property + type. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData + :ivar properties: Settings properties. + :vartype properties: ~azure.mgmt.hybridcompute.models.SettingsProperties + """ + + properties: Optional["_models.SettingsProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Settings properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.SettingsProperties"] = 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 SettingsGatewayProperties(_Model): + """Settings Gateway properties. + + :ivar gateway_resource_id: Associated Gateway Resource Id. + :vartype gateway_resource_id: str + """ + + gateway_resource_id: Optional[str] = rest_field( + name="gatewayResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Associated Gateway Resource Id.""" + + @overload + def __init__( + self, + *, + gateway_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 SettingsProperties(_Model): + """Settings properties. + + :ivar tenant_id: Azure resource tenant Id. + :vartype tenant_id: str + :ivar gateway_properties: Settings Gateway properties. + :vartype gateway_properties: ~azure.mgmt.hybridcompute.models.SettingsGatewayProperties + """ + + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """Azure resource tenant Id.""" + gateway_properties: Optional["_models.SettingsGatewayProperties"] = rest_field( + name="gatewayProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """Settings Gateway properties.""" + + __flattened_items = ["gateway_resource_id"] + + @overload + def __init__( + self, + *, + gateway_properties: Optional["_models.SettingsGatewayProperties"] = 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.gateway_properties is None: + return None + return getattr(self.gateway_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.gateway_properties is None: + self.gateway_properties = self._attr_to_rest_field["gateway_properties"]._class_type() + setattr(self.gateway_properties, key, value) + else: + super().__setattr__(key, value) + + +class SetupExtensionRequest(_Model): + """SetupExtensionRequest. + + :ivar extensions: The list of extensions. + :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionProperties] + """ + + extensions: Optional[list["_models.MachineExtensionProperties"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The list of extensions.""" + + @overload + def __init__( + self, + *, + extensions: Optional[list["_models.MachineExtensionProperties"]] = 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 StorageProfile(_Model): + """Describes the storage configuration of the machine. + + :ivar disks: The disks on the machine. + :vartype disks: list[~azure.mgmt.hybridcompute.models.Disk] + """ + + disks: Optional[list["_models.Disk"]] = rest_field(visibility=["read"]) + """The disks on the machine.""" + + +class Subnet(_Model): + """Describes the subnet. + + :ivar address_prefix: Represents address prefix. + :vartype address_prefix: str + """ + + address_prefix: Optional[str] = rest_field( + name="addressPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """Represents address prefix.""" + + @overload + def __init__( + self, + *, + address_prefix: 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 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.hybridcompute.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.hybridcompute.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 TagsResource(_Model): + """A container holding only the Tags for a resource, allowing the user to update the tags on a + PrivateLinkScope instance. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + """ + + tags: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + + @overload + def __init__( + self, + *, + 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 VolumeLicenseDetails(_Model): + """VolumeLicenseDetails. + + :ivar program_year: Describes the program year the volume license is for. Known values are: + "Year 1", "Year 2", and "Year 3". + :vartype program_year: str or ~azure.mgmt.hybridcompute.models.ProgramYear + :ivar invoice_id: The invoice id for the volume license. + :vartype invoice_id: str + """ + + program_year: Optional[Union[str, "_models.ProgramYear"]] = rest_field( + name="programYear", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the program year the volume license is for. Known values are: \"Year 1\", \"Year 2\", + and \"Year 3\".""" + invoice_id: Optional[str] = rest_field(name="invoiceId", visibility=["read", "create", "update", "delete", "query"]) + """The invoice id for the volume license.""" + + @overload + def __init__( + self, + *, + program_year: Optional[Union[str, "_models.ProgramYear"]] = None, + invoice_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 WindowsParameters(_Model): + """Input for InstallPatches on a Windows VM, as directly received by the API. + + :ivar classifications_to_include: The update classifications to select when installing patches + for Windows. + :vartype classifications_to_include: list[str or + ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows] + :ivar kb_numbers_to_include: Kbs to include in the patch operation. + :vartype kb_numbers_to_include: list[str] + :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. + :vartype kb_numbers_to_exclude: list[str] + :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an + InstallationRebootBehavior of 'NeverReboots' when this is set to true. + :vartype exclude_kbs_requiring_reboot: bool + :ivar max_patch_publish_date: This is used to install patches that were published on or before + this given max published date. + :vartype max_patch_publish_date: ~datetime.datetime + :ivar patch_name_masks_to_include: This is used to include patches that match the given patch + name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only + supported as input values in the list. Null, empty and only whitespaces strings as inputs + values are not supported. + :vartype patch_name_masks_to_include: list[str] + :ivar patch_name_masks_to_exclude: This is used to exclude patches that match the given patch + name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only + supported as input values in the list. Null, empty and only whitespaces strings as inputs + values are not supported. + :vartype patch_name_masks_to_exclude: list[str] + """ + + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = rest_field( + name="classificationsToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """The update classifications to select when installing patches for Windows.""" + kb_numbers_to_include: Optional[list[str]] = rest_field( + name="kbNumbersToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Kbs to include in the patch operation.""" + kb_numbers_to_exclude: Optional[list[str]] = rest_field( + name="kbNumbersToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """Kbs to exclude in the patch operation.""" + exclude_kbs_requiring_reboot: Optional[bool] = rest_field( + name="excludeKbsRequiringReboot", visibility=["read", "create", "update", "delete", "query"] + ) + """Filters out Kbs that don't have an InstallationRebootBehavior of 'NeverReboots' when this is + set to true.""" + max_patch_publish_date: Optional[datetime.datetime] = rest_field( + name="maxPatchPublishDate", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """This is used to install patches that were published on or before this given max published date.""" + patch_name_masks_to_include: Optional[list[str]] = rest_field( + name="patchNameMasksToInclude", visibility=["read", "create", "update", "delete", "query"] + ) + """This is used to include patches that match the given patch name masks. Alphanumeric strings and + wildcard expressions consisting of * and ? are only supported as input values in the list. + Null, empty and only whitespaces strings as inputs values are not supported.""" + patch_name_masks_to_exclude: Optional[list[str]] = rest_field( + name="patchNameMasksToExclude", visibility=["read", "create", "update", "delete", "query"] + ) + """This is used to exclude patches that match the given patch name masks. Alphanumeric strings and + wildcard expressions consisting of * and ? are only supported as input values in the list. + Null, empty and only whitespaces strings as inputs values are not supported.""" + + @overload + def __init__( + self, + *, + classifications_to_include: Optional[list[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, + kb_numbers_to_include: Optional[list[str]] = None, + kb_numbers_to_exclude: Optional[list[str]] = None, + exclude_kbs_requiring_reboot: Optional[bool] = None, + max_patch_publish_date: Optional[datetime.datetime] = None, + patch_name_masks_to_include: Optional[list[str]] = None, + patch_name_masks_to_exclude: 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py deleted file mode 100644 index a23d9ca6460d..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_models_py3.py +++ /dev/null @@ -1,5968 +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. -# -------------------------------------------------------------------------- - -import datetime -from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Union - -from .._utils import serialization as _serialization - -if TYPE_CHECKING: - from .. import models as _models - - -class AccessRule(_serialization.Model): - """Access rule. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the access rule. - :vartype name: str - :ivar direction: Direction of the access rule. Known values are: "Inbound" and "Outbound". - :vartype direction: str or ~azure.mgmt.hybridcompute.models.AccessRuleDirection - :ivar address_prefixes: Address prefixes that are allowed access. - :vartype address_prefixes: list[str] - """ - - _validation = { - "name": {"readonly": True}, - "direction": {"readonly": True}, - "address_prefixes": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "direction": {"key": "properties.direction", "type": "str"}, - "address_prefixes": {"key": "properties.addressPrefixes", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.direction: Optional[Union[str, "_models.AccessRuleDirection"]] = None - self.address_prefixes: Optional[List[str]] = None - - -class AgentConfiguration(_serialization.Model): - """Configurable properties that the user can set locally via the azcmagent config command, or - remotely via ARM. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar proxy_url: Specifies the URL of the proxy to be used. - :vartype proxy_url: str - :ivar incoming_connections_ports: Specifies the list of ports that the agent will be able to - listen on. - :vartype incoming_connections_ports: list[str] - :ivar extensions_allow_list: Array of extensions that are allowed to be installed or updated. - :vartype extensions_allow_list: list[~azure.mgmt.hybridcompute.models.ConfigurationExtension] - :ivar extensions_block_list: Array of extensions that are blocked (cannot be installed or - updated). - :vartype extensions_block_list: list[~azure.mgmt.hybridcompute.models.ConfigurationExtension] - :ivar proxy_bypass: List of service names which should not use the specified proxy server. - :vartype proxy_bypass: list[str] - :ivar extensions_enabled: Specifies whether the extension service is enabled or disabled. - :vartype extensions_enabled: str - :ivar guest_configuration_enabled: Specified whether the guest configuration service is enabled - or disabled. - :vartype guest_configuration_enabled: str - :ivar config_mode: Name of configuration mode to use. Modes are pre-defined configurations of - security controls, extension allowlists and guest configuration, maintained by Microsoft. Known - values are: "full" and "monitor". - :vartype config_mode: str or ~azure.mgmt.hybridcompute.models.AgentConfigurationMode - """ - - _validation = { - "proxy_url": {"readonly": True}, - "incoming_connections_ports": {"readonly": True}, - "extensions_allow_list": {"readonly": True}, - "extensions_block_list": {"readonly": True}, - "proxy_bypass": {"readonly": True}, - "extensions_enabled": {"readonly": True}, - "guest_configuration_enabled": {"readonly": True}, - "config_mode": {"readonly": True}, - } - - _attribute_map = { - "proxy_url": {"key": "proxyUrl", "type": "str"}, - "incoming_connections_ports": {"key": "incomingConnectionsPorts", "type": "[str]"}, - "extensions_allow_list": {"key": "extensionsAllowList", "type": "[ConfigurationExtension]"}, - "extensions_block_list": {"key": "extensionsBlockList", "type": "[ConfigurationExtension]"}, - "proxy_bypass": {"key": "proxyBypass", "type": "[str]"}, - "extensions_enabled": {"key": "extensionsEnabled", "type": "str"}, - "guest_configuration_enabled": {"key": "guestConfigurationEnabled", "type": "str"}, - "config_mode": {"key": "configMode", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.proxy_url: Optional[str] = None - self.incoming_connections_ports: Optional[List[str]] = None - self.extensions_allow_list: Optional[List["_models.ConfigurationExtension"]] = None - self.extensions_block_list: Optional[List["_models.ConfigurationExtension"]] = None - self.proxy_bypass: Optional[List[str]] = None - self.extensions_enabled: Optional[str] = None - self.guest_configuration_enabled: Optional[str] = None - self.config_mode: Optional[Union[str, "_models.AgentConfigurationMode"]] = None - - -class AgentUpgrade(_serialization.Model): - """The info w.r.t Agent Upgrade. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar desired_version: Specifies the version info w.r.t AgentUpgrade for the machine. - :vartype desired_version: str - :ivar correlation_id: The correlation ID associated with an agent upgrade operation. - :vartype correlation_id: str - :ivar enable_automatic_upgrade: Specifies if the machine's agent should be upgraded. - :vartype enable_automatic_upgrade: bool - :ivar last_attempt_desired_version: Specifies the version of the last attempt. - :vartype last_attempt_desired_version: str - :ivar last_attempt_timestamp: Timestamp of last upgrade attempt. - :vartype last_attempt_timestamp: ~datetime.datetime - :ivar last_attempt_status: Specifies the status of Agent Upgrade. Known values are: "Success" - and "Failed". - :vartype last_attempt_status: str or ~azure.mgmt.hybridcompute.models.LastAttemptStatusEnum - :ivar last_attempt_message: Failure message of last upgrade attempt if any. - :vartype last_attempt_message: str - """ - - _validation = { - "last_attempt_desired_version": {"readonly": True}, - "last_attempt_timestamp": {"readonly": True}, - "last_attempt_status": {"readonly": True}, - "last_attempt_message": {"readonly": True}, - } - - _attribute_map = { - "desired_version": {"key": "desiredVersion", "type": "str"}, - "correlation_id": {"key": "correlationId", "type": "str"}, - "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, - "last_attempt_desired_version": {"key": "lastAttemptDesiredVersion", "type": "str"}, - "last_attempt_timestamp": {"key": "lastAttemptTimestamp", "type": "iso-8601"}, - "last_attempt_status": {"key": "lastAttemptStatus", "type": "str"}, - "last_attempt_message": {"key": "lastAttemptMessage", "type": "str"}, - } - - def __init__( - self, - *, - desired_version: Optional[str] = None, - correlation_id: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword desired_version: Specifies the version info w.r.t AgentUpgrade for the machine. - :paramtype desired_version: str - :keyword correlation_id: The correlation ID associated with an agent upgrade operation. - :paramtype correlation_id: str - :keyword enable_automatic_upgrade: Specifies if the machine's agent should be upgraded. - :paramtype enable_automatic_upgrade: bool - """ - super().__init__(**kwargs) - self.desired_version = desired_version - self.correlation_id = correlation_id - self.enable_automatic_upgrade = enable_automatic_upgrade - self.last_attempt_desired_version: Optional[str] = None - self.last_attempt_timestamp: Optional[datetime.datetime] = None - self.last_attempt_status: Optional[Union[str, "_models.LastAttemptStatusEnum"]] = None - self.last_attempt_message: Optional[str] = None - - -class AgentVersion(_serialization.Model): - """Describes properties of Agent Version. - - :ivar agent_version: Represents the agent version. - :vartype agent_version: str - :ivar download_link: Represents the download link of specific agent version. - :vartype download_link: str - :ivar os_type: Defines the os type. - :vartype os_type: str - """ - - _attribute_map = { - "agent_version": {"key": "agentVersion", "type": "str"}, - "download_link": {"key": "downloadLink", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - } - - def __init__( - self, - *, - agent_version: Optional[str] = None, - download_link: Optional[str] = None, - os_type: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword agent_version: Represents the agent version. - :paramtype agent_version: str - :keyword download_link: Represents the download link of specific agent version. - :paramtype download_link: str - :keyword os_type: Defines the os type. - :paramtype os_type: str - """ - super().__init__(**kwargs) - self.agent_version = agent_version - self.download_link = download_link - self.os_type = os_type - - -class AgentVersionsList(_serialization.Model): - """Describes AgentVersions List. - - :ivar value: The list of available Agent Versions. - :vartype value: list[~azure.mgmt.hybridcompute.models.AgentVersion] - :ivar next_link: The URI to fetch the next 10 available Agent Versions. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[AgentVersion]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.AgentVersion"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of available Agent Versions. - :paramtype value: list[~azure.mgmt.hybridcompute.models.AgentVersion] - :keyword next_link: The URI to fetch the next 10 available Agent Versions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AvailablePatchCountByClassification(_serialization.Model): - """Summarization of patches available for installation on the machine by classification. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar security: Number of security patches available for installation. - :vartype security: int - :ivar critical: Number of critical patches available for installation. - :vartype critical: int - :ivar definition: Number of definition patches available for installation. - :vartype definition: int - :ivar update_rollup: Number of update Rollup patches available for installation. - :vartype update_rollup: int - :ivar feature_pack: Number of feature pack patches available for installation. - :vartype feature_pack: int - :ivar service_pack: Number of service pack patches available for installation. - :vartype service_pack: int - :ivar tools: Number of tools patches available for installation. - :vartype tools: int - :ivar updates: Number of updates category patches available for installation. - :vartype updates: int - :ivar other: Number of other patches available for installation. - :vartype other: int - """ - - _validation = { - "security": {"readonly": True}, - "critical": {"readonly": True}, - "definition": {"readonly": True}, - "update_rollup": {"readonly": True}, - "feature_pack": {"readonly": True}, - "service_pack": {"readonly": True}, - "tools": {"readonly": True}, - "updates": {"readonly": True}, - "other": {"readonly": True}, - } - - _attribute_map = { - "security": {"key": "security", "type": "int"}, - "critical": {"key": "critical", "type": "int"}, - "definition": {"key": "definition", "type": "int"}, - "update_rollup": {"key": "updateRollup", "type": "int"}, - "feature_pack": {"key": "featurePack", "type": "int"}, - "service_pack": {"key": "servicePack", "type": "int"}, - "tools": {"key": "tools", "type": "int"}, - "updates": {"key": "updates", "type": "int"}, - "other": {"key": "other", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.security: Optional[int] = None - self.critical: Optional[int] = None - self.definition: Optional[int] = None - self.update_rollup: Optional[int] = None - self.feature_pack: Optional[int] = None - self.service_pack: Optional[int] = None - self.tools: Optional[int] = None - self.updates: Optional[int] = None - self.other: Optional[int] = None - - -class CloudMetadata(_serialization.Model): - """The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: Specifies the cloud provider (Azure/AWS/GCP...). - :vartype provider: str - """ - - _validation = { - "provider": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider: Optional[str] = None - - -class ConfigurationExtension(_serialization.Model): - """Describes properties that can identify extensions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar publisher: Publisher of the extension. - :vartype publisher: str - :ivar type: Type of the extension. - :vartype type: str - """ - - _validation = { - "publisher": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "publisher": {"key": "publisher", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.publisher: Optional[str] = None - self.type: Optional[str] = None - - -class ConnectionDetail(_serialization.Model): - """ConnectionDetail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar private_ip_address: The private endpoint connection private ip address. - :vartype private_ip_address: str - :ivar link_identifier: The private endpoint connection link identifier. - :vartype link_identifier: str - :ivar group_id: The private endpoint connection group id. - :vartype group_id: str - :ivar member_name: The private endpoint connection member name. - :vartype member_name: str - """ - - _validation = { - "id": {"readonly": True}, - "private_ip_address": {"readonly": True}, - "link_identifier": {"readonly": True}, - "group_id": {"readonly": True}, - "member_name": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "private_ip_address": {"key": "privateIpAddress", "type": "str"}, - "link_identifier": {"key": "linkIdentifier", "type": "str"}, - "group_id": {"key": "groupId", "type": "str"}, - "member_name": {"key": "memberName", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.private_ip_address: Optional[str] = None - self.link_identifier: Optional[str] = None - self.group_id: Optional[str] = None - self.member_name: Optional[str] = None - - -class Disk(_serialization.Model): - """Describes a disk on the machine. - - :ivar path: The path of the disk. - :vartype path: str - :ivar disk_type: The type of the disk. - :vartype disk_type: str - :ivar generated_id: The generated ID of the disk. - :vartype generated_id: str - :ivar id: The ID of the disk. - :vartype id: str - :ivar name: The name of the disk. - :vartype name: str - :ivar max_size_in_bytes: The size of the disk, in bytes. - :vartype max_size_in_bytes: int - :ivar used_space_in_bytes: The amount of space used on the disk, in bytes. - :vartype used_space_in_bytes: int - """ - - _attribute_map = { - "path": {"key": "path", "type": "str"}, - "disk_type": {"key": "diskType", "type": "str"}, - "generated_id": {"key": "generatedId", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "max_size_in_bytes": {"key": "maxSizeInBytes", "type": "int"}, - "used_space_in_bytes": {"key": "usedSpaceInBytes", "type": "int"}, - } - - def __init__( - self, - *, - path: Optional[str] = None, - disk_type: Optional[str] = None, - generated_id: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - max_size_in_bytes: Optional[int] = None, - used_space_in_bytes: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword path: The path of the disk. - :paramtype path: str - :keyword disk_type: The type of the disk. - :paramtype disk_type: str - :keyword generated_id: The generated ID of the disk. - :paramtype generated_id: str - :keyword id: The ID of the disk. - :paramtype id: str - :keyword name: The name of the disk. - :paramtype name: str - :keyword max_size_in_bytes: The size of the disk, in bytes. - :paramtype max_size_in_bytes: int - :keyword used_space_in_bytes: The amount of space used on the disk, in bytes. - :paramtype used_space_in_bytes: int - """ - super().__init__(**kwargs) - self.path = path - self.disk_type = disk_type - self.generated_id = generated_id - self.id = id - self.name = name - self.max_size_in_bytes = max_size_in_bytes - self.used_space_in_bytes = used_space_in_bytes - - -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.hybridcompute.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~azure.mgmt.hybridcompute.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.hybridcompute.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.hybridcompute.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class EsuKey(_serialization.Model): - """ESU key. - - :ivar sku: SKU number. - :vartype sku: str - :ivar license_status: The current status of the license profile key. Represented by the same - integer value that is presented on the machine itself when querying the license key status. - :vartype license_status: int - """ - - _attribute_map = { - "sku": {"key": "sku", "type": "str"}, - "license_status": {"key": "licenseStatus", "type": "int"}, - } - - def __init__(self, *, sku: Optional[str] = None, license_status: Optional[int] = None, **kwargs: Any) -> None: - """ - :keyword sku: SKU number. - :paramtype sku: str - :keyword license_status: The current status of the license profile key. Represented by the same - integer value that is presented on the machine itself when querying the license key status. - :paramtype license_status: int - """ - super().__init__(**kwargs) - self.sku = sku - self.license_status = license_status - - -class ExtensionPublisher(_serialization.Model): - """Describes an Extension Publisher. - - :ivar id: The ID of the extension publisher. - :vartype id: str - :ivar name: The name of the extension publisher. - :vartype name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ID of the extension publisher. - :paramtype id: str - :keyword name: The name of the extension publisher. - :paramtype name: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - - -class ExtensionPublisherListResult(_serialization.Model): - """The List of Extension Publishers. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of extension publishers. - :vartype value: list[~azure.mgmt.hybridcompute.models.ExtensionPublisher] - :ivar next_link: The URI to fetch the next page of extension publishers. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ExtensionPublisher]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The URI to fetch the next page of extension publishers. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[List["_models.ExtensionPublisher"]] = None - self.next_link = next_link - - -class ExtensionsResourceStatus(_serialization.Model): - """Instance view status. - - :ivar code: The status code. - :vartype code: str - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.hybridcompute.models.ExtensionsStatusLevelTypes - :ivar display_status: The short localizable label for the status. - :vartype display_status: str - :ivar message: The detailed status message, including for alerts and error messages. - :vartype message: str - :ivar time: The time of the status. - :vartype time: ~datetime.datetime - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - level: Optional[Union[str, "_models.ExtensionsStatusLevelTypes"]] = None, - display_status: Optional[str] = None, - message: Optional[str] = None, - time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: The status code. - :paramtype code: str - :keyword level: The level code. Known values are: "Info", "Warning", and "Error". - :paramtype level: str or ~azure.mgmt.hybridcompute.models.ExtensionsStatusLevelTypes - :keyword display_status: The short localizable label for the status. - :paramtype display_status: str - :keyword message: The detailed status message, including for alerts and error messages. - :paramtype message: str - :keyword time: The time of the status. - :paramtype time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.code = code - self.level = level - self.display_status = display_status - self.message = message - self.time = time - - -class ExtensionTargetProperties(_serialization.Model): - """Describes the Machine Extension Target Version Properties. - - :ivar target_version: Properties for the specified Extension to Upgrade. - :vartype target_version: str - """ - - _attribute_map = { - "target_version": {"key": "targetVersion", "type": "str"}, - } - - def __init__(self, *, target_version: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword target_version: Properties for the specified Extension to Upgrade. - :paramtype target_version: str - """ - super().__init__(**kwargs) - self.target_version = target_version - - -class ExtensionType(_serialization.Model): - """Describes an Extension Type. - - :ivar id: The ID of the extension type. - :vartype id: str - :ivar name: The name of the extension type. - :vartype name: str - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The ID of the extension type. - :paramtype id: str - :keyword name: The name of the extension type. - :paramtype name: str - """ - super().__init__(**kwargs) - self.id = id - self.name = name - - -class ExtensionTypeListResult(_serialization.Model): - """The List of Extension Types. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of extension types. - :vartype value: list[~azure.mgmt.hybridcompute.models.ExtensionType] - :ivar next_link: The URI to fetch the next page of extension types. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ExtensionType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The URI to fetch the next page of extension types. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[List["_models.ExtensionType"]] = None - self.next_link = next_link - - -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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - """ - - -class ExtensionValue(ProxyResource): - """Describes a Extension Metadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar version: The version of the Extension being received. - :vartype version: str - :ivar extension_type: The type of the Extension being received. - :vartype extension_type: str - :ivar publisher: The publisher of the Extension being received. - :vartype publisher: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "version": {"readonly": True}, - "extension_type": {"readonly": True}, - "publisher": {"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"}, - "version": {"key": "properties.version", "type": "str"}, - "extension_type": {"key": "properties.extensionType", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.extension_type: Optional[str] = None - self.publisher: Optional[str] = None - - -class ExtensionValueListResult(_serialization.Model): - """The List Extension Metadata response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of extension metadata. - :vartype value: list[~azure.mgmt.hybridcompute.models.ExtensionValue] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ExtensionValue]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.ExtensionValue"]] = None - - -class ExtensionValueListResultV2(_serialization.Model): - """The List Extension Metadata response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of extension metadata. - :vartype value: list[~azure.mgmt.hybridcompute.models.ExtensionValueV2] - :ivar next_link: The URI to fetch the next page of extension metadata. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ExtensionValueV2]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword next_link: The URI to fetch the next page of extension metadata. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value: Optional[List["_models.ExtensionValueV2"]] = None - self.next_link = next_link - - -class ExtensionValueProperties(_serialization.Model): - """Describes Extension Metadata properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The version of the Extension being received. - :vartype version: str - :ivar extension_type: The type of the Extension being received. - :vartype extension_type: str - :ivar publisher: The publisher of the Extension being received. - :vartype publisher: str - """ - - _validation = { - "version": {"readonly": True}, - "extension_type": {"readonly": True}, - "publisher": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "extension_type": {"key": "extensionType", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.extension_type: Optional[str] = None - self.publisher: Optional[str] = None - - -class ResourceAutoGenerated(_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.hybridcompute.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 ProxyResourceAutoGenerated(ResourceAutoGenerated): - """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.hybridcompute.models.SystemData - """ - - -class ExtensionValueV2(ProxyResourceAutoGenerated): - """Describes an Extension Metadata. - - 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.hybridcompute.models.SystemData - :ivar version: The version of the Extension being received. - :vartype version: str - :ivar extension_type: The type of the Extension being received. - :vartype extension_type: str - :ivar publisher: The publisher of the Extension being received. - :vartype publisher: str - :ivar extension_uris: A list of locations where the extension packages can be found. - :vartype extension_uris: list[str] - :ivar extension_signature_uri: Location of the signature files for the extension. - :vartype extension_signature_uri: str - :ivar operating_system: The operating system (Windows, Linux, etc.) this extension supports. - :vartype operating_system: str - :ivar architecture: Architectures (x64, arms64, etc.) that this extension supports. - :vartype architecture: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "version": {"readonly": True}, - "extension_type": {"readonly": True}, - "publisher": {"readonly": True}, - "extension_uris": {"readonly": True}, - "extension_signature_uri": {"readonly": True}, - "operating_system": {"readonly": True}, - "architecture": {"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"}, - "version": {"key": "properties.version", "type": "str"}, - "extension_type": {"key": "properties.extensionType", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "extension_uris": {"key": "properties.extensionUris", "type": "[str]"}, - "extension_signature_uri": {"key": "properties.extensionSignatureUri", "type": "str"}, - "operating_system": {"key": "properties.operatingSystem", "type": "str"}, - "architecture": {"key": "properties.architecture", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version: Optional[str] = None - self.extension_type: Optional[str] = None - self.publisher: Optional[str] = None - self.extension_uris: Optional[List[str]] = None - self.extension_signature_uri: Optional[str] = None - self.operating_system: Optional[str] = None - self.architecture: Optional[List[str]] = None - - -class ExtensionValueV2Properties(ExtensionValueProperties): - """Describes Extension Metadata properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The version of the Extension being received. - :vartype version: str - :ivar extension_type: The type of the Extension being received. - :vartype extension_type: str - :ivar publisher: The publisher of the Extension being received. - :vartype publisher: str - :ivar extension_uris: A list of locations where the extension packages can be found. - :vartype extension_uris: list[str] - :ivar extension_signature_uri: Location of the signature files for the extension. - :vartype extension_signature_uri: str - :ivar operating_system: The operating system (Windows, Linux, etc.) this extension supports. - :vartype operating_system: str - :ivar architecture: Architectures (x64, arms64, etc.) that this extension supports. - :vartype architecture: list[str] - """ - - _validation = { - "version": {"readonly": True}, - "extension_type": {"readonly": True}, - "publisher": {"readonly": True}, - "extension_uris": {"readonly": True}, - "extension_signature_uri": {"readonly": True}, - "operating_system": {"readonly": True}, - "architecture": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - "extension_type": {"key": "extensionType", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "extension_uris": {"key": "extensionUris", "type": "[str]"}, - "extension_signature_uri": {"key": "extensionSignatureUri", "type": "str"}, - "operating_system": {"key": "operatingSystem", "type": "str"}, - "architecture": {"key": "architecture", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.extension_uris: Optional[List[str]] = None - self.extension_signature_uri: Optional[str] = None - self.operating_system: Optional[str] = None - self.architecture: Optional[List[str]] = None - - -class FirmwareProfile(_serialization.Model): - """Describes the firmware of the machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar serial_number: The serial number of the firmware. - :vartype serial_number: str - :ivar type: The type of the firmware. - :vartype type: str - """ - - _validation = { - "serial_number": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "serial_number": {"key": "serialNumber", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.serial_number: Optional[str] = None - self.type: Optional[str] = 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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 Gateway(TrackedResource): - """Describes an Arc Gateway. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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, which only appears in the response. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", - and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState - :ivar gateway_id: A unique, immutable, identifier for the Gateway. - :vartype gateway_id: str - :ivar gateway_type: The type of the Gateway resource. "Public" - :vartype gateway_type: str or ~azure.mgmt.hybridcompute.models.GatewayType - :ivar gateway_endpoint: The endpoint fqdn for the Gateway. - :vartype gateway_endpoint: str - :ivar allowed_features: Specifies the list of features that are enabled for this Gateway. - :vartype allowed_features: list[str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "gateway_id": {"readonly": True}, - "gateway_endpoint": {"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"}, - "gateway_id": {"key": "properties.gatewayId", "type": "str"}, - "gateway_type": {"key": "properties.gatewayType", "type": "str"}, - "gateway_endpoint": {"key": "properties.gatewayEndpoint", "type": "str"}, - "allowed_features": {"key": "properties.allowedFeatures", "type": "[str]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - gateway_type: Optional[Union[str, "_models.GatewayType"]] = None, - allowed_features: Optional[List[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 gateway_type: The type of the Gateway resource. "Public" - :paramtype gateway_type: str or ~azure.mgmt.hybridcompute.models.GatewayType - :keyword allowed_features: Specifies the list of features that are enabled for this Gateway. - :paramtype allowed_features: list[str] - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.gateway_id: Optional[str] = None - self.gateway_type = gateway_type - self.gateway_endpoint: Optional[str] = None - self.allowed_features = allowed_features - - -class GatewaysListResult(_serialization.Model): - """The List license operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of Gateways. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.Gateway] - :ivar next_link: The URI to fetch the next page of Gateways. Call ListNext() with this URI to - fetch the next page of Gateways. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Gateway]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Gateway"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of Gateways. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.Gateway] - :keyword next_link: The URI to fetch the next page of Gateways. Call ListNext() with this URI - to fetch the next page of Gateways. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ResourceUpdate(_serialization.Model): - """The Update Resource model definition. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class GatewayUpdate(ResourceUpdate): - """Describes a License Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar allowed_features: Specifies the list of features that are enabled for this Gateway. - :vartype allowed_features: list[str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "allowed_features": {"key": "properties.allowedFeatures", "type": "[str]"}, - } - - def __init__( - self, *, tags: Optional[Dict[str, str]] = None, allowed_features: Optional[List[str]] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword allowed_features: Specifies the list of features that are enabled for this Gateway. - :paramtype allowed_features: list[str] - """ - super().__init__(tags=tags, **kwargs) - self.allowed_features = allowed_features - - -class HardwareProfile(_serialization.Model): - """Describes the hardware of the machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar total_physical_memory_in_bytes: The total physical memory on the machine. - :vartype total_physical_memory_in_bytes: int - :ivar number_of_cpu_sockets: The total number of CPU sockets available on the machine. - :vartype number_of_cpu_sockets: int - :ivar processors: The physical processors of the machine. - :vartype processors: list[~azure.mgmt.hybridcompute.models.Processor] - """ - - _validation = { - "total_physical_memory_in_bytes": {"readonly": True}, - "number_of_cpu_sockets": {"readonly": True}, - "processors": {"readonly": True}, - } - - _attribute_map = { - "total_physical_memory_in_bytes": {"key": "totalPhysicalMemoryInBytes", "type": "int"}, - "number_of_cpu_sockets": {"key": "numberOfCpuSockets", "type": "int"}, - "processors": {"key": "processors", "type": "[Processor]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.total_physical_memory_in_bytes: Optional[int] = None - self.number_of_cpu_sockets: Optional[int] = None - self.processors: Optional[List["_models.Processor"]] = None - - -class PrivateLinkScopesResource(_serialization.Model): - """An azure resource object. - - 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: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.location = location - self.tags = tags - - -class HybridComputePrivateLinkScope(PrivateLinkScopesResource): - """An Azure Arc PrivateLinkScope definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location. Required. - :vartype location: str - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar properties: Properties that define a Azure Arc PrivateLinkScope resource. - :vartype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "properties": {"key": "properties", "type": "HybridComputePrivateLinkScopeProperties"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.HybridComputePrivateLinkScopeProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword properties: Properties that define a Azure Arc PrivateLinkScope resource. - :paramtype properties: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScopeProperties - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - self.system_data: Optional["_models.SystemData"] = None - - -class HybridComputePrivateLinkScopeListResult(_serialization.Model): - """Describes the list of Azure Arc PrivateLinkScope resources. - - All required parameters must be populated in order to send to server. - - :ivar value: List of Azure Arc PrivateLinkScope definitions. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :ivar next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if too - many PrivateLinkScopes where returned in the result set. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[HybridComputePrivateLinkScope]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.HybridComputePrivateLinkScope"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: List of Azure Arc PrivateLinkScope definitions. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :keyword next_link: The URI to get the next set of Azure Arc PrivateLinkScope definitions if - too many PrivateLinkScopes where returned in the result set. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class HybridComputePrivateLinkScopeProperties(_serialization.Model): - """Properties that define a Azure Arc PrivateLinkScope resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", and - "SecuredByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType - :ivar provisioning_state: Current state of this PrivateLinkScope: whether or not is has been - provisioned within the resource group it is defined. Users cannot change this value but are - able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - :vartype provisioning_state: str - :ivar private_link_scope_id: The Guid id of the private link scope. - :vartype private_link_scope_id: str - :ivar private_endpoint_connections: The collection of associated Private Endpoint Connections. - :vartype private_endpoint_connections: - list[~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionDataModel] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "private_link_scope_id": {"readonly": True}, - "private_endpoint_connections": {"readonly": True}, - } - - _attribute_map = { - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "private_link_scope_id": {"key": "privateLinkScopeId", "type": "str"}, - "private_endpoint_connections": { - "key": "privateEndpointConnections", - "type": "[PrivateEndpointConnectionDataModel]", - }, - } - - def __init__( - self, *, public_network_access: Union[str, "_models.PublicNetworkAccessType"] = "Disabled", **kwargs: Any - ) -> None: - """ - :keyword public_network_access: Indicates whether machines associated with the private link - scope can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", - and "SecuredByPerimeter". - :paramtype public_network_access: str or - ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType - """ - super().__init__(**kwargs) - self.public_network_access = public_network_access - self.provisioning_state: Optional[str] = None - self.private_link_scope_id: Optional[str] = None - self.private_endpoint_connections: Optional[List["_models.PrivateEndpointConnectionDataModel"]] = None - - -class HybridIdentityMetadata(ProxyResource): - """Defines the HybridIdentityMetadata. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar vm_id: The unique identifier for the resource. - :vartype vm_id: str - :ivar public_key: The Public Key. - :vartype public_key: str - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.hybridcompute.models.Identity - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "identity": {"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"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, - "public_key": {"key": "properties.publicKey", "type": "str"}, - "identity": {"key": "properties.identity", "type": "Identity"}, - } - - def __init__(self, *, vm_id: Optional[str] = None, public_key: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword vm_id: The unique identifier for the resource. - :paramtype vm_id: str - :keyword public_key: The Public Key. - :paramtype public_key: str - """ - super().__init__(**kwargs) - self.vm_id = vm_id - self.public_key = public_key - self.identity: Optional["_models.Identity"] = None - - -class HybridIdentityMetadataList(_serialization.Model): - """List of HybridIdentityMetadata. - - All required parameters must be populated in order to send to server. - - :ivar next_link: Url to follow for getting next page of HybridIdentityMetadata. - :vartype next_link: str - :ivar value: Array of HybridIdentityMetadata. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "next_link": {"key": "nextLink", "type": "str"}, - "value": {"key": "value", "type": "[HybridIdentityMetadata]"}, - } - - def __init__( - self, *, value: List["_models.HybridIdentityMetadata"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword next_link: Url to follow for getting next page of HybridIdentityMetadata. - :paramtype next_link: str - :keyword value: Array of HybridIdentityMetadata. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.HybridIdentityMetadata] - """ - super().__init__(**kwargs) - self.next_link = next_link - self.value = value - - -class Identity(_serialization.Model): - """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. Default value is "SystemAssigned". - :vartype type: str - """ - - _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"}, - } - - def __init__(self, *, type: Optional[Literal["SystemAssigned"]] = None, **kwargs: Any) -> None: - """ - :keyword type: The identity type. Default value is "SystemAssigned". - :paramtype type: str - """ - super().__init__(**kwargs) - self.principal_id: Optional[str] = None - self.tenant_id: Optional[str] = None - self.type = type - - -class IpAddress(_serialization.Model): - """Describes properties of the IP address. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar address: Represents the IP Address. - :vartype address: str - :ivar ip_address_version: Represents the Ip Address Version. - :vartype ip_address_version: str - :ivar subnet: The subnet to which this IP address belongs. - :vartype subnet: ~azure.mgmt.hybridcompute.models.Subnet - """ - - _validation = { - "subnet": {"readonly": True}, - } - - _attribute_map = { - "address": {"key": "address", "type": "str"}, - "ip_address_version": {"key": "ipAddressVersion", "type": "str"}, - "subnet": {"key": "subnet", "type": "Subnet"}, - } - - def __init__( - self, *, address: Optional[str] = None, ip_address_version: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword address: Represents the IP Address. - :paramtype address: str - :keyword ip_address_version: Represents the Ip Address Version. - :paramtype ip_address_version: str - """ - super().__init__(**kwargs) - self.address = address - self.ip_address_version = ip_address_version - self.subnet: Optional["_models.Subnet"] = None - - -class KeyDetails(_serialization.Model): - """Public key details. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar public_key: Public key. - :vartype public_key: str - :ivar not_after: Key expiration date. - :vartype not_after: ~datetime.datetime - :ivar renew_after: Recommended key renewal date. - :vartype renew_after: ~datetime.datetime - """ - - _validation = { - "public_key": {"readonly": True}, - "not_after": {"readonly": True}, - "renew_after": {"readonly": True}, - } - - _attribute_map = { - "public_key": {"key": "publicKey", "type": "str"}, - "not_after": {"key": "notAfter", "type": "iso-8601"}, - "renew_after": {"key": "renewAfter", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.public_key: Optional[str] = None - self.not_after: Optional[datetime.datetime] = None - self.renew_after: Optional[datetime.datetime] = None - - -class KeyProperties(_serialization.Model): - """Public key information for client authentication. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar client_public_key: Current public key details. - :vartype client_public_key: ~azure.mgmt.hybridcompute.models.KeyDetails - :ivar candidate_public_key: Candidate public key details. - :vartype candidate_public_key: ~azure.mgmt.hybridcompute.models.KeyDetails - """ - - _validation = { - "client_public_key": {"readonly": True}, - "candidate_public_key": {"readonly": True}, - } - - _attribute_map = { - "client_public_key": {"key": "clientPublicKey", "type": "KeyDetails"}, - "candidate_public_key": {"key": "candidatePublicKey", "type": "KeyDetails"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.client_public_key: Optional["_models.KeyDetails"] = None - self.candidate_public_key: Optional["_models.KeyDetails"] = None - - -class License(TrackedResource): - """Describes a license in a hybrid machine. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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, which only appears in the response. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", - and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState - :ivar tenant_id: Describes the tenant id. - :vartype tenant_id: str - :ivar license_type: The type of the license resource. "ESU" - :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType - :ivar license_details: Describes the properties of a License. - :vartype license_details: ~azure.mgmt.hybridcompute.models.LicenseDetails - """ - - _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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "license_type": {"key": "properties.licenseType", "type": "str"}, - "license_details": {"key": "properties.licenseDetails", "type": "LicenseDetails"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - tenant_id: Optional[str] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - license_details: Optional["_models.LicenseDetails"] = 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 tenant_id: Describes the tenant id. - :paramtype tenant_id: str - :keyword license_type: The type of the license resource. "ESU" - :paramtype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType - :keyword license_details: Describes the properties of a License. - :paramtype license_details: ~azure.mgmt.hybridcompute.models.LicenseDetails - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.tenant_id = tenant_id - self.license_type = license_type - self.license_details = license_details - - -class LicenseDetails(_serialization.Model): - """Describes the properties of a License. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar state: Describes the state of the license. Known values are: "Activated" and - "Deactivated". - :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState - :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and - "Windows Server 2012 R2". - :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget - :ivar edition: Describes the edition of the license. The values are either Standard or - Datacenter. Known values are: "Standard" and "Datacenter". - :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition - :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and - "vCore". - :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType - :ivar processors: Describes the number of processors. - :vartype processors: int - :ivar assigned_licenses: Describes the number of assigned licenses. - :vartype assigned_licenses: int - :ivar immutable_id: Describes the immutable id. - :vartype immutable_id: str - :ivar volume_license_details: A list of volume license details. - :vartype volume_license_details: list[~azure.mgmt.hybridcompute.models.VolumeLicenseDetails] - """ - - _validation = { - "assigned_licenses": {"readonly": True}, - "immutable_id": {"readonly": True}, - } - - _attribute_map = { - "state": {"key": "state", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "edition": {"key": "edition", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "processors": {"key": "processors", "type": "int"}, - "assigned_licenses": {"key": "assignedLicenses", "type": "int"}, - "immutable_id": {"key": "immutableId", "type": "str"}, - "volume_license_details": {"key": "volumeLicenseDetails", "type": "[VolumeLicenseDetails]"}, - } - - def __init__( - self, - *, - state: Optional[Union[str, "_models.LicenseState"]] = None, - target: Optional[Union[str, "_models.LicenseTarget"]] = None, - edition: Optional[Union[str, "_models.LicenseEdition"]] = None, - type: Optional[Union[str, "_models.LicenseCoreType"]] = None, - processors: Optional[int] = None, - volume_license_details: Optional[List["_models.VolumeLicenseDetails"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword state: Describes the state of the license. Known values are: "Activated" and - "Deactivated". - :paramtype state: str or ~azure.mgmt.hybridcompute.models.LicenseState - :keyword target: Describes the license target server. Known values are: "Windows Server 2012" - and "Windows Server 2012 R2". - :paramtype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget - :keyword edition: Describes the edition of the license. The values are either Standard or - Datacenter. Known values are: "Standard" and "Datacenter". - :paramtype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition - :keyword type: Describes the license core type (pCore or vCore). Known values are: "pCore" and - "vCore". - :paramtype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType - :keyword processors: Describes the number of processors. - :paramtype processors: int - :keyword volume_license_details: A list of volume license details. - :paramtype volume_license_details: list[~azure.mgmt.hybridcompute.models.VolumeLicenseDetails] - """ - super().__init__(**kwargs) - self.state = state - self.target = target - self.edition = edition - self.type = type - self.processors = processors - self.assigned_licenses: Optional[int] = None - self.immutable_id: Optional[str] = None - self.volume_license_details = volume_license_details - - -class LicenseProfile(TrackedResource): - """Describes a license profile in a hybrid machine. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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, which only appears in the response. Known - values are: "Creating", "Updating", "Deleting", "Succeeded", "Failed", "Accepted", "Canceled", - and "Deleted". - :vartype provisioning_state: str or ~azure.mgmt.hybridcompute.models.ProvisioningState - :ivar subscription_status: Indicates the subscription status of the product. Known values are: - "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :vartype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - :ivar product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :vartype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :ivar enrollment_date: The timestamp in UTC when the user enrolls the feature. - :vartype enrollment_date: ~datetime.datetime - :ivar billing_start_date: The timestamp in UTC when the billing starts. - :vartype billing_start_date: ~datetime.datetime - :ivar disenrollment_date: The timestamp in UTC when the user disenrolled the feature. - :vartype disenrollment_date: ~datetime.datetime - :ivar billing_end_date: The timestamp in UTC when the billing ends. - :vartype billing_end_date: ~datetime.datetime - :ivar error: The errors that were encountered during the feature enrollment or disenrollment. - :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail - :ivar product_features: The list of product features. - :vartype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeature] - :ivar assigned_license_immutable_id: The guid id of the license. - :vartype assigned_license_immutable_id: str - :ivar esu_keys: The list of ESU keys. - :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] - :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". - :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType - :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", - "Ineligible", and "Unknown". - :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility - :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. - Known values are: "Inactive" and "Active". - :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState - :ivar assigned_license: The resource id of the license. - :vartype assigned_license: str - :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software - Assurance agreement. - :vartype software_assurance_customer: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "enrollment_date": {"readonly": True}, - "billing_start_date": {"readonly": True}, - "disenrollment_date": {"readonly": True}, - "billing_end_date": {"readonly": True}, - "error": {"readonly": True}, - "assigned_license_immutable_id": {"readonly": True}, - "esu_keys": {"readonly": True}, - "server_type": {"readonly": True}, - "esu_eligibility": {"readonly": True}, - "esu_key_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"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "subscription_status": {"key": "properties.productProfile.subscriptionStatus", "type": "str"}, - "product_type": {"key": "properties.productProfile.productType", "type": "str"}, - "enrollment_date": {"key": "properties.productProfile.enrollmentDate", "type": "iso-8601"}, - "billing_start_date": {"key": "properties.productProfile.billingStartDate", "type": "iso-8601"}, - "disenrollment_date": {"key": "properties.productProfile.disenrollmentDate", "type": "iso-8601"}, - "billing_end_date": {"key": "properties.productProfile.billingEndDate", "type": "iso-8601"}, - "error": {"key": "properties.productProfile.error", "type": "ErrorDetail"}, - "product_features": {"key": "properties.productProfile.productFeatures", "type": "[ProductFeature]"}, - "assigned_license_immutable_id": {"key": "properties.esuProfile.assignedLicenseImmutableId", "type": "str"}, - "esu_keys": {"key": "properties.esuProfile.esuKeys", "type": "[EsuKey]"}, - "server_type": {"key": "properties.esuProfile.serverType", "type": "str"}, - "esu_eligibility": {"key": "properties.esuProfile.esuEligibility", "type": "str"}, - "esu_key_state": {"key": "properties.esuProfile.esuKeyState", "type": "str"}, - "assigned_license": {"key": "properties.esuProfile.assignedLicense", "type": "str"}, - "software_assurance_customer": { - "key": "properties.softwareAssurance.softwareAssuranceCustomer", - "type": "bool", - }, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = None, - product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = None, - product_features: Optional[List["_models.ProductFeature"]] = None, - assigned_license: Optional[str] = None, - software_assurance_customer: Optional[bool] = 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 subscription_status: Indicates the subscription status of the product. Known values - are: "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :paramtype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - :keyword product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :paramtype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :keyword product_features: The list of product features. - :paramtype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeature] - :keyword assigned_license: The resource id of the license. - :paramtype assigned_license: str - :keyword software_assurance_customer: Specifies if this machine is licensed as part of a - Software Assurance agreement. - :paramtype software_assurance_customer: bool - """ - super().__init__(tags=tags, location=location, **kwargs) - self.provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None - self.subscription_status = subscription_status - self.product_type = product_type - self.enrollment_date: Optional[datetime.datetime] = None - self.billing_start_date: Optional[datetime.datetime] = None - self.disenrollment_date: Optional[datetime.datetime] = None - self.billing_end_date: Optional[datetime.datetime] = None - self.error: Optional["_models.ErrorDetail"] = None - self.product_features = product_features - self.assigned_license_immutable_id: Optional[str] = None - self.esu_keys: Optional[List["_models.EsuKey"]] = None - self.server_type: Optional[Union[str, "_models.EsuServerType"]] = None - self.esu_eligibility: Optional[Union[str, "_models.EsuEligibility"]] = None - self.esu_key_state: Optional[Union[str, "_models.EsuKeyState"]] = None - self.assigned_license = assigned_license - self.software_assurance_customer = software_assurance_customer - - -class LicenseProfileStorageModelEsuProperties(_serialization.Model): - """License profile storage model for ESU properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assigned_license_immutable_id: The guid id of the license. - :vartype assigned_license_immutable_id: str - :ivar esu_keys: The list of ESU keys. - :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] - """ - - _validation = { - "assigned_license_immutable_id": {"readonly": True}, - "esu_keys": {"readonly": True}, - } - - _attribute_map = { - "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, - "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.assigned_license_immutable_id: Optional[str] = None - self.esu_keys: Optional[List["_models.EsuKey"]] = None - - -class LicenseProfileArmEsuPropertiesWithoutAssignedLicense( - LicenseProfileStorageModelEsuProperties -): # pylint: disable=name-too-long - """Describes the properties of a License Profile ARM model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assigned_license_immutable_id: The guid id of the license. - :vartype assigned_license_immutable_id: str - :ivar esu_keys: The list of ESU keys. - :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] - :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". - :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType - :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", - "Ineligible", and "Unknown". - :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility - :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. - Known values are: "Inactive" and "Active". - :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState - """ - - _validation = { - "assigned_license_immutable_id": {"readonly": True}, - "esu_keys": {"readonly": True}, - "server_type": {"readonly": True}, - "esu_eligibility": {"readonly": True}, - "esu_key_state": {"readonly": True}, - } - - _attribute_map = { - "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, - "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, - "server_type": {"key": "serverType", "type": "str"}, - "esu_eligibility": {"key": "esuEligibility", "type": "str"}, - "esu_key_state": {"key": "esuKeyState", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.server_type: Optional[Union[str, "_models.EsuServerType"]] = None - self.esu_eligibility: Optional[Union[str, "_models.EsuEligibility"]] = None - self.esu_key_state: Optional[Union[str, "_models.EsuKeyState"]] = None - - -class LicenseProfileArmEsuProperties(LicenseProfileArmEsuPropertiesWithoutAssignedLicense): - """Describes the properties of a License Profile ARM model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assigned_license_immutable_id: The guid id of the license. - :vartype assigned_license_immutable_id: str - :ivar esu_keys: The list of ESU keys. - :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] - :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". - :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType - :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", - "Ineligible", and "Unknown". - :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility - :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. - Known values are: "Inactive" and "Active". - :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState - :ivar assigned_license: The resource id of the license. - :vartype assigned_license: str - """ - - _validation = { - "assigned_license_immutable_id": {"readonly": True}, - "esu_keys": {"readonly": True}, - "server_type": {"readonly": True}, - "esu_eligibility": {"readonly": True}, - "esu_key_state": {"readonly": True}, - } - - _attribute_map = { - "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, - "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, - "server_type": {"key": "serverType", "type": "str"}, - "esu_eligibility": {"key": "esuEligibility", "type": "str"}, - "esu_key_state": {"key": "esuKeyState", "type": "str"}, - "assigned_license": {"key": "assignedLicense", "type": "str"}, - } - - def __init__(self, *, assigned_license: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword assigned_license: The resource id of the license. - :paramtype assigned_license: str - """ - super().__init__(**kwargs) - self.assigned_license = assigned_license - - -class LicenseProfileMachineInstanceView(_serialization.Model): - """License Profile Instance View in Machine Properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar license_status: Indicates the license status of the OS. Known values are: "Unlicensed", - "Licensed", "OOBGrace", "OOTGrace", "NonGenuineGrace", "Notification", and "ExtendedGrace". - :vartype license_status: str or ~azure.mgmt.hybridcompute.models.LicenseStatus - :ivar license_channel: Indicates the license channel. - :vartype license_channel: str - :ivar esu_profile: Properties for the Machine ESU profile. - :vartype esu_profile: - ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties - :ivar subscription_status: Indicates the subscription status of the product. Known values are: - "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :vartype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - :ivar product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :vartype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :ivar enrollment_date: The timestamp in UTC when the user enrolls the feature. - :vartype enrollment_date: ~datetime.datetime - :ivar billing_start_date: The timestamp in UTC when the billing starts. - :vartype billing_start_date: ~datetime.datetime - :ivar disenrollment_date: The timestamp in UTC when the user disenrolled the feature. - :vartype disenrollment_date: ~datetime.datetime - :ivar billing_end_date: The timestamp in UTC when the billing ends. - :vartype billing_end_date: ~datetime.datetime - :ivar error: The errors that were encountered during the feature enrollment or disenrollment. - :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail - :ivar product_features: The list of product features. - :vartype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeature] - :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software - Assurance agreement. - :vartype software_assurance_customer: bool - """ - - _validation = { - "license_status": {"readonly": True}, - "license_channel": {"readonly": True}, - "enrollment_date": {"readonly": True}, - "billing_start_date": {"readonly": True}, - "disenrollment_date": {"readonly": True}, - "billing_end_date": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "license_status": {"key": "licenseStatus", "type": "str"}, - "license_channel": {"key": "licenseChannel", "type": "str"}, - "esu_profile": {"key": "esuProfile", "type": "LicenseProfileMachineInstanceViewEsuProperties"}, - "subscription_status": {"key": "productProfile.subscriptionStatus", "type": "str"}, - "product_type": {"key": "productProfile.productType", "type": "str"}, - "enrollment_date": {"key": "productProfile.enrollmentDate", "type": "iso-8601"}, - "billing_start_date": {"key": "productProfile.billingStartDate", "type": "iso-8601"}, - "disenrollment_date": {"key": "productProfile.disenrollmentDate", "type": "iso-8601"}, - "billing_end_date": {"key": "productProfile.billingEndDate", "type": "iso-8601"}, - "error": {"key": "productProfile.error", "type": "ErrorDetail"}, - "product_features": {"key": "productProfile.productFeatures", "type": "[ProductFeature]"}, - "software_assurance_customer": {"key": "softwareAssurance.softwareAssuranceCustomer", "type": "bool"}, - } - - def __init__( - self, - *, - esu_profile: Optional["_models.LicenseProfileMachineInstanceViewEsuProperties"] = None, - subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = None, - product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = None, - product_features: Optional[List["_models.ProductFeature"]] = None, - software_assurance_customer: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword esu_profile: Properties for the Machine ESU profile. - :paramtype esu_profile: - ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceViewEsuProperties - :keyword subscription_status: Indicates the subscription status of the product. Known values - are: "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :paramtype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - :keyword product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :paramtype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :keyword product_features: The list of product features. - :paramtype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeature] - :keyword software_assurance_customer: Specifies if this machine is licensed as part of a - Software Assurance agreement. - :paramtype software_assurance_customer: bool - """ - super().__init__(**kwargs) - self.license_status: Optional[Union[str, "_models.LicenseStatus"]] = None - self.license_channel: Optional[str] = None - self.esu_profile = esu_profile - self.subscription_status = subscription_status - self.product_type = product_type - self.enrollment_date: Optional[datetime.datetime] = None - self.billing_start_date: Optional[datetime.datetime] = None - self.disenrollment_date: Optional[datetime.datetime] = None - self.billing_end_date: Optional[datetime.datetime] = None - self.error: Optional["_models.ErrorDetail"] = None - self.product_features = product_features - self.software_assurance_customer = software_assurance_customer - - -class LicenseProfileMachineInstanceViewEsuProperties( - LicenseProfileArmEsuPropertiesWithoutAssignedLicense -): # pylint: disable=name-too-long - """Properties for the Machine ESU profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assigned_license_immutable_id: The guid id of the license. - :vartype assigned_license_immutable_id: str - :ivar esu_keys: The list of ESU keys. - :vartype esu_keys: list[~azure.mgmt.hybridcompute.models.EsuKey] - :ivar server_type: The type of the Esu servers. Known values are: "Standard" and "Datacenter". - :vartype server_type: str or ~azure.mgmt.hybridcompute.models.EsuServerType - :ivar esu_eligibility: Indicates the eligibility state of Esu. Known values are: "Eligible", - "Ineligible", and "Unknown". - :vartype esu_eligibility: str or ~azure.mgmt.hybridcompute.models.EsuEligibility - :ivar esu_key_state: Indicates whether there is an ESU Key currently active for the machine. - Known values are: "Inactive" and "Active". - :vartype esu_key_state: str or ~azure.mgmt.hybridcompute.models.EsuKeyState - :ivar assigned_license: The assigned license resource. - :vartype assigned_license: ~azure.mgmt.hybridcompute.models.License - :ivar license_assignment_state: Describes the license assignment state (Assigned or - NotAssigned). Known values are: "Assigned" and "NotAssigned". - :vartype license_assignment_state: str or - ~azure.mgmt.hybridcompute.models.LicenseAssignmentState - """ - - _validation = { - "assigned_license_immutable_id": {"readonly": True}, - "esu_keys": {"readonly": True}, - "server_type": {"readonly": True}, - "esu_eligibility": {"readonly": True}, - "esu_key_state": {"readonly": True}, - } - - _attribute_map = { - "assigned_license_immutable_id": {"key": "assignedLicenseImmutableId", "type": "str"}, - "esu_keys": {"key": "esuKeys", "type": "[EsuKey]"}, - "server_type": {"key": "serverType", "type": "str"}, - "esu_eligibility": {"key": "esuEligibility", "type": "str"}, - "esu_key_state": {"key": "esuKeyState", "type": "str"}, - "assigned_license": {"key": "assignedLicense", "type": "License"}, - "license_assignment_state": {"key": "licenseAssignmentState", "type": "str"}, - } - - def __init__( - self, - *, - assigned_license: Optional["_models.License"] = None, - license_assignment_state: Optional[Union[str, "_models.LicenseAssignmentState"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword assigned_license: The assigned license resource. - :paramtype assigned_license: ~azure.mgmt.hybridcompute.models.License - :keyword license_assignment_state: Describes the license assignment state (Assigned or - NotAssigned). Known values are: "Assigned" and "NotAssigned". - :paramtype license_assignment_state: str or - ~azure.mgmt.hybridcompute.models.LicenseAssignmentState - """ - super().__init__(**kwargs) - self.assigned_license = assigned_license - self.license_assignment_state = license_assignment_state - - -class LicenseProfilesListResult(_serialization.Model): - """The List hybrid machine license profile operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of license profiles. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.LicenseProfile] - :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of license profile. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[LicenseProfile]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.LicenseProfile"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of license profiles. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.LicenseProfile] - :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI - to fetch the next page of license profile. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LicenseProfileUpdate(ResourceUpdate): - """Describes a License Profile Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar subscription_status: Indicates the subscription status of the product. Known values are: - "Enable" and "Disable". - :vartype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate - :ivar product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :vartype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :ivar product_features: The list of product feature updates. - :vartype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeatureUpdate] - :ivar assigned_license: The resource id of the license. - :vartype assigned_license: str - :ivar software_assurance_customer: Specifies if this machine is licensed as part of a Software - Assurance agreement. - :vartype software_assurance_customer: bool - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "subscription_status": {"key": "properties.productProfile.subscriptionStatus", "type": "str"}, - "product_type": {"key": "properties.productProfile.productType", "type": "str"}, - "product_features": {"key": "properties.productProfile.productFeatures", "type": "[ProductFeatureUpdate]"}, - "assigned_license": {"key": "properties.esuProfile.assignedLicense", "type": "str"}, - "software_assurance_customer": { - "key": "properties.softwareAssurance.softwareAssuranceCustomer", - "type": "bool", - }, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = None, - product_type: Optional[Union[str, "_models.LicenseProfileProductType"]] = None, - product_features: Optional[List["_models.ProductFeatureUpdate"]] = None, - assigned_license: Optional[str] = None, - software_assurance_customer: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword subscription_status: Indicates the subscription status of the product. Known values - are: "Enable" and "Disable". - :paramtype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate - :keyword product_type: Indicates the product type of the license. Known values are: - "WindowsServer" and "WindowsIoTEnterprise". - :paramtype product_type: str or ~azure.mgmt.hybridcompute.models.LicenseProfileProductType - :keyword product_features: The list of product feature updates. - :paramtype product_features: list[~azure.mgmt.hybridcompute.models.ProductFeatureUpdate] - :keyword assigned_license: The resource id of the license. - :paramtype assigned_license: str - :keyword software_assurance_customer: Specifies if this machine is licensed as part of a - Software Assurance agreement. - :paramtype software_assurance_customer: bool - """ - super().__init__(tags=tags, **kwargs) - self.subscription_status = subscription_status - self.product_type = product_type - self.product_features = product_features - self.assigned_license = assigned_license - self.software_assurance_customer = software_assurance_customer - - -class LicensesListResult(_serialization.Model): - """The List license operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of licenses. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.License] - :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of license profile. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[License]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.License"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of licenses. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.License] - :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI - to fetch the next page of license profile. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class LicenseUpdate(ResourceUpdate): - """Describes a License Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar license_type: The type of the license resource. "ESU" - :vartype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType - :ivar state: Describes the state of the license. Known values are: "Activated" and - "Deactivated". - :vartype state: str or ~azure.mgmt.hybridcompute.models.LicenseState - :ivar target: Describes the license target server. Known values are: "Windows Server 2012" and - "Windows Server 2012 R2". - :vartype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget - :ivar edition: Describes the edition of the license. The values are either Standard or - Datacenter. Known values are: "Standard" and "Datacenter". - :vartype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition - :ivar type: Describes the license core type (pCore or vCore). Known values are: "pCore" and - "vCore". - :vartype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType - :ivar processors: Describes the number of processors. - :vartype processors: int - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "license_type": {"key": "properties.licenseType", "type": "str"}, - "state": {"key": "properties.licenseDetails.state", "type": "str"}, - "target": {"key": "properties.licenseDetails.target", "type": "str"}, - "edition": {"key": "properties.licenseDetails.edition", "type": "str"}, - "type": {"key": "properties.licenseDetails.type", "type": "str"}, - "processors": {"key": "properties.licenseDetails.processors", "type": "int"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - license_type: Optional[Union[str, "_models.LicenseType"]] = None, - state: Optional[Union[str, "_models.LicenseState"]] = None, - target: Optional[Union[str, "_models.LicenseTarget"]] = None, - edition: Optional[Union[str, "_models.LicenseEdition"]] = None, - type: Optional[Union[str, "_models.LicenseCoreType"]] = None, - processors: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword license_type: The type of the license resource. "ESU" - :paramtype license_type: str or ~azure.mgmt.hybridcompute.models.LicenseType - :keyword state: Describes the state of the license. Known values are: "Activated" and - "Deactivated". - :paramtype state: str or ~azure.mgmt.hybridcompute.models.LicenseState - :keyword target: Describes the license target server. Known values are: "Windows Server 2012" - and "Windows Server 2012 R2". - :paramtype target: str or ~azure.mgmt.hybridcompute.models.LicenseTarget - :keyword edition: Describes the edition of the license. The values are either Standard or - Datacenter. Known values are: "Standard" and "Datacenter". - :paramtype edition: str or ~azure.mgmt.hybridcompute.models.LicenseEdition - :keyword type: Describes the license core type (pCore or vCore). Known values are: "pCore" and - "vCore". - :paramtype type: str or ~azure.mgmt.hybridcompute.models.LicenseCoreType - :keyword processors: Describes the number of processors. - :paramtype processors: int - """ - super().__init__(tags=tags, **kwargs) - self.license_type = license_type - self.state = state - self.target = target - self.edition = edition - self.type = type - self.processors = processors - - -class LinuxParameters(_serialization.Model): - """Input for InstallPatches on a Linux VM, as directly received by the API. - - :ivar classifications_to_include: The update classifications to select when installing patches - for Linux. - :vartype classifications_to_include: list[str or - ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux] - :ivar package_name_masks_to_include: packages to include in the patch operation. Format: - packageName_packageVersion. - :vartype package_name_masks_to_include: list[str] - :ivar package_name_masks_to_exclude: packages to exclude in the patch operation. Format: - packageName_packageVersion. - :vartype package_name_masks_to_exclude: list[str] - """ - - _attribute_map = { - "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, - "package_name_masks_to_include": {"key": "packageNameMasksToInclude", "type": "[str]"}, - "package_name_masks_to_exclude": {"key": "packageNameMasksToExclude", "type": "[str]"}, - } - - def __init__( - self, - *, - classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationLinux"]]] = None, - package_name_masks_to_include: Optional[List[str]] = None, - package_name_masks_to_exclude: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Linux. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationLinux] - :keyword package_name_masks_to_include: packages to include in the patch operation. Format: - packageName_packageVersion. - :paramtype package_name_masks_to_include: list[str] - :keyword package_name_masks_to_exclude: packages to exclude in the patch operation. Format: - packageName_packageVersion. - :paramtype package_name_masks_to_exclude: list[str] - """ - super().__init__(**kwargs) - self.classifications_to_include = classifications_to_include - self.package_name_masks_to_include = package_name_masks_to_include - self.package_name_masks_to_exclude = package_name_masks_to_exclude - - -class LocationData(_serialization.Model): - """Metadata pertaining to the geographic location of the resource. - - All required parameters must be populated in order to send to server. - - :ivar name: A canonical name for the geographic or physical location. Required. - :vartype name: str - :ivar city: The city or locality where the resource is located. - :vartype city: str - :ivar district: The district, state, or province where the resource is located. - :vartype district: str - :ivar country_or_region: The country or region where the resource is located. - :vartype country_or_region: str - """ - - _validation = { - "name": {"required": True, "max_length": 256}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "city": {"key": "city", "type": "str"}, - "district": {"key": "district", "type": "str"}, - "country_or_region": {"key": "countryOrRegion", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - city: Optional[str] = None, - district: Optional[str] = None, - country_or_region: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: A canonical name for the geographic or physical location. Required. - :paramtype name: str - :keyword city: The city or locality where the resource is located. - :paramtype city: str - :keyword district: The district, state, or province where the resource is located. - :paramtype district: str - :keyword country_or_region: The country or region where the resource is located. - :paramtype country_or_region: str - """ - super().__init__(**kwargs) - self.name = name - self.city = city - self.district = district - self.country_or_region = country_or_region - - -class Machine(TrackedResource): - """Describes a hybrid machine. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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 resources: The list of extensions affiliated to the machine. - :vartype resources: list[~azure.mgmt.hybridcompute.models.MachineExtension] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.hybridcompute.models.Identity - :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or - VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". - :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum - :ivar location_data: Metadata pertaining to the geographic location of the resource. - :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :ivar agent_configuration: Configurable properties that the user can set locally via the - azcmagent config command, or remotely via ARM. - :vartype agent_configuration: ~azure.mgmt.hybridcompute.models.AgentConfiguration - :ivar service_statuses: Statuses of dependent services that are reported back to ARM. - :vartype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses - :ivar hardware_profile: Information about the machine's hardware. - :vartype hardware_profile: ~azure.mgmt.hybridcompute.models.HardwareProfile - :ivar storage_profile: Information about the machine's storage. - :vartype storage_profile: ~azure.mgmt.hybridcompute.models.StorageProfile - :ivar firmware_profile: Information about the machine's firmware. - :vartype firmware_profile: ~azure.mgmt.hybridcompute.models.FirmwareProfile - :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. - :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade - :ivar os_profile: Specifies the operating system settings for the hybrid machine. - :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :ivar license_profile: Specifies the License related properties for a machine. - :vartype license_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar status: The status of the hybrid machine agent. Known values are: "Connected", - "Disconnected", "Error", and "AwaitingConnection". - :vartype status: str or ~azure.mgmt.hybridcompute.models.StatusTypes - :ivar last_status_change: The time of the last status change. - :vartype last_status_change: ~datetime.datetime - :ivar error_details: Details about the error state. - :vartype error_details: list[~azure.mgmt.hybridcompute.models.ErrorDetail] - :ivar agent_version: The hybrid machine agent full version. - :vartype agent_version: str - :ivar vm_id: Specifies the hybrid machine unique ID. - :vartype vm_id: str - :ivar display_name: Specifies the hybrid machine display name. - :vartype display_name: str - :ivar machine_fqdn: Specifies the hybrid machine FQDN. - :vartype machine_fqdn: str - :ivar client_public_key: Public Key that the client provides to be used during initial resource - onboarding. - :vartype client_public_key: str - :ivar identity_key_store: Specifies the identity key store a machine is using. Known values - are: "TPM" and "Default". - :vartype identity_key_store: str or ~azure.mgmt.hybridcompute.models.IdentityKeyStore - :ivar tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) that - the client provides to be used during initial resource onboarding. - :vartype tpm_ek_certificate: str - :ivar os_name: The Operating System running on the hybrid machine. - :vartype os_name: str - :ivar os_version: The version of Operating System running on the hybrid machine. - :vartype os_version: str - :ivar os_type: The type of Operating System (windows/linux). - :vartype os_type: str - :ivar vm_uuid: Specifies the Arc Machine's unique SMBIOS ID. - :vartype vm_uuid: str - :ivar extensions: Machine Extensions information (deprecated field). - :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] - :ivar os_sku: Specifies the Operating System product SKU. - :vartype os_sku: str - :ivar os_edition: The edition of the Operating System. - :vartype os_edition: str - :ivar domain_name: Specifies the Windows domain name. - :vartype domain_name: str - :ivar ad_fqdn: Specifies the AD fully qualified display name. - :vartype ad_fqdn: str - :ivar dns_fqdn: Specifies the DNS fully qualified display name. - :vartype dns_fqdn: str - :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is - assigned to, if any. - :vartype private_link_scope_resource_id: str - :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :vartype parent_cluster_resource_id: str - :ivar hardware_resource_id: Specifies the resource ID of the associated hardware device. Only - settable by HCI RP. - :vartype hardware_resource_id: str - :ivar mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :vartype mssql_discovered: str - :ivar detected_properties: Detected properties from the machine. - :vartype detected_properties: dict[str, str] - :ivar network_profile: Information about the network the machine is on. - :vartype network_profile: ~azure.mgmt.hybridcompute.models.NetworkProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "resources": {"readonly": True}, - "agent_configuration": {"readonly": True}, - "hardware_profile": {"readonly": True}, - "storage_profile": {"readonly": True}, - "firmware_profile": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - "last_status_change": {"readonly": True}, - "error_details": {"readonly": True}, - "agent_version": {"readonly": True}, - "display_name": {"readonly": True}, - "machine_fqdn": {"readonly": True}, - "os_name": {"readonly": True}, - "os_version": {"readonly": True}, - "vm_uuid": {"readonly": True}, - "os_sku": {"readonly": True}, - "os_edition": {"readonly": True}, - "domain_name": {"readonly": True}, - "ad_fqdn": {"readonly": True}, - "dns_fqdn": {"readonly": True}, - "detected_properties": {"readonly": True}, - "network_profile": {"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"}, - "resources": {"key": "resources", "type": "[MachineExtension]"}, - "identity": {"key": "identity", "type": "Identity"}, - "kind": {"key": "kind", "type": "str"}, - "location_data": {"key": "properties.locationData", "type": "LocationData"}, - "agent_configuration": {"key": "properties.agentConfiguration", "type": "AgentConfiguration"}, - "service_statuses": {"key": "properties.serviceStatuses", "type": "ServiceStatuses"}, - "hardware_profile": {"key": "properties.hardwareProfile", "type": "HardwareProfile"}, - "storage_profile": {"key": "properties.storageProfile", "type": "StorageProfile"}, - "firmware_profile": {"key": "properties.firmwareProfile", "type": "FirmwareProfile"}, - "cloud_metadata": {"key": "properties.cloudMetadata", "type": "CloudMetadata"}, - "agent_upgrade": {"key": "properties.agentUpgrade", "type": "AgentUpgrade"}, - "os_profile": {"key": "properties.osProfile", "type": "OSProfile"}, - "license_profile": {"key": "properties.licenseProfile", "type": "LicenseProfileMachineInstanceView"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "status": {"key": "properties.status", "type": "str"}, - "last_status_change": {"key": "properties.lastStatusChange", "type": "iso-8601"}, - "error_details": {"key": "properties.errorDetails", "type": "[ErrorDetail]"}, - "agent_version": {"key": "properties.agentVersion", "type": "str"}, - "vm_id": {"key": "properties.vmId", "type": "str"}, - "display_name": {"key": "properties.displayName", "type": "str"}, - "machine_fqdn": {"key": "properties.machineFqdn", "type": "str"}, - "client_public_key": {"key": "properties.clientPublicKey", "type": "str"}, - "identity_key_store": {"key": "properties.identityKeyStore", "type": "str"}, - "tpm_ek_certificate": {"key": "properties.tpmEkCertificate", "type": "str"}, - "os_name": {"key": "properties.osName", "type": "str"}, - "os_version": {"key": "properties.osVersion", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - "vm_uuid": {"key": "properties.vmUuid", "type": "str"}, - "extensions": {"key": "properties.extensions", "type": "[MachineExtensionInstanceView]"}, - "os_sku": {"key": "properties.osSku", "type": "str"}, - "os_edition": {"key": "properties.osEdition", "type": "str"}, - "domain_name": {"key": "properties.domainName", "type": "str"}, - "ad_fqdn": {"key": "properties.adFqdn", "type": "str"}, - "dns_fqdn": {"key": "properties.dnsFqdn", "type": "str"}, - "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, - "parent_cluster_resource_id": {"key": "properties.parentClusterResourceId", "type": "str"}, - "hardware_resource_id": {"key": "properties.hardwareResourceId", "type": "str"}, - "mssql_discovered": {"key": "properties.mssqlDiscovered", "type": "str"}, - "detected_properties": {"key": "properties.detectedProperties", "type": "{str}"}, - "network_profile": {"key": "properties.networkProfile", "type": "NetworkProfile"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - kind: Optional[Union[str, "_models.ArcKindEnum"]] = None, - location_data: Optional["_models.LocationData"] = None, - service_statuses: Optional["_models.ServiceStatuses"] = None, - cloud_metadata: Optional["_models.CloudMetadata"] = None, - agent_upgrade: Optional["_models.AgentUpgrade"] = None, - os_profile: Optional["_models.OSProfile"] = None, - license_profile: Optional["_models.LicenseProfileMachineInstanceView"] = None, - vm_id: Optional[str] = None, - client_public_key: Optional[str] = None, - identity_key_store: Optional[Union[str, "_models.IdentityKeyStore"]] = None, - tpm_ek_certificate: Optional[str] = None, - os_type: Optional[str] = None, - extensions: Optional[List["_models.MachineExtensionInstanceView"]] = None, - private_link_scope_resource_id: Optional[str] = None, - parent_cluster_resource_id: Optional[str] = None, - hardware_resource_id: Optional[str] = None, - mssql_discovered: 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 identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.hybridcompute.models.Identity - :keyword kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or - VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". - :paramtype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum - :keyword location_data: Metadata pertaining to the geographic location of the resource. - :paramtype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :keyword service_statuses: Statuses of dependent services that are reported back to ARM. - :paramtype service_statuses: ~azure.mgmt.hybridcompute.models.ServiceStatuses - :keyword cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :paramtype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :keyword agent_upgrade: The info of the machine w.r.t Agent Upgrade. - :paramtype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade - :keyword os_profile: Specifies the operating system settings for the hybrid machine. - :paramtype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :keyword license_profile: Specifies the License related properties for a machine. - :paramtype license_profile: ~azure.mgmt.hybridcompute.models.LicenseProfileMachineInstanceView - :keyword vm_id: Specifies the hybrid machine unique ID. - :paramtype vm_id: str - :keyword client_public_key: Public Key that the client provides to be used during initial - resource onboarding. - :paramtype client_public_key: str - :keyword identity_key_store: Specifies the identity key store a machine is using. Known values - are: "TPM" and "Default". - :paramtype identity_key_store: str or ~azure.mgmt.hybridcompute.models.IdentityKeyStore - :keyword tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) - that the client provides to be used during initial resource onboarding. - :paramtype tpm_ek_certificate: str - :keyword os_type: The type of Operating System (windows/linux). - :paramtype os_type: str - :keyword extensions: Machine Extensions information (deprecated field). - :paramtype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView] - :keyword private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :paramtype private_link_scope_resource_id: str - :keyword parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :paramtype parent_cluster_resource_id: str - :keyword hardware_resource_id: Specifies the resource ID of the associated hardware device. - Only settable by HCI RP. - :paramtype hardware_resource_id: str - :keyword mssql_discovered: Specifies whether any MS SQL instance is discovered on the machine. - :paramtype mssql_discovered: str - """ - super().__init__(tags=tags, location=location, **kwargs) - self.resources: Optional[List["_models.MachineExtension"]] = None - self.identity = identity - self.kind = kind - self.location_data = location_data - self.agent_configuration: Optional["_models.AgentConfiguration"] = None - self.service_statuses = service_statuses - self.hardware_profile: Optional["_models.HardwareProfile"] = None - self.storage_profile: Optional["_models.StorageProfile"] = None - self.firmware_profile: Optional["_models.FirmwareProfile"] = None - self.cloud_metadata = cloud_metadata - self.agent_upgrade = agent_upgrade - self.os_profile = os_profile - self.license_profile = license_profile - self.provisioning_state: Optional[str] = None - self.status: Optional[Union[str, "_models.StatusTypes"]] = None - self.last_status_change: Optional[datetime.datetime] = None - self.error_details: Optional[List["_models.ErrorDetail"]] = None - self.agent_version: Optional[str] = None - self.vm_id = vm_id - self.display_name: Optional[str] = None - self.machine_fqdn: Optional[str] = None - self.client_public_key = client_public_key - self.identity_key_store = identity_key_store - self.tpm_ek_certificate = tpm_ek_certificate - self.os_name: Optional[str] = None - self.os_version: Optional[str] = None - self.os_type = os_type - self.vm_uuid: Optional[str] = None - self.extensions = extensions - self.os_sku: Optional[str] = None - self.os_edition: Optional[str] = None - self.domain_name: Optional[str] = None - self.ad_fqdn: Optional[str] = None - self.dns_fqdn: Optional[str] = None - self.private_link_scope_resource_id = private_link_scope_resource_id - self.parent_cluster_resource_id = parent_cluster_resource_id - self.hardware_resource_id = hardware_resource_id - self.mssql_discovered = mssql_discovered - self.detected_properties: Optional[Dict[str, str]] = None - self.network_profile: Optional["_models.NetworkProfile"] = None - - -class MachineAssessPatchesResult(_serialization.Model): - """Describes the properties of an AssessPatches result. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The overall success or failure status of the operation. It remains "InProgress" - until the operation completes. At that point it will become "Unknown", "Failed", "Succeeded", - or "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", - and "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus - :ivar assessment_activity_id: The activity ID of the operation that produced this result. - :vartype assessment_activity_id: str - :ivar reboot_pending: The overall reboot status of the VM. It will be true when partially - installed patches require a reboot to complete installation but the reboot has not yet - occurred. - :vartype reboot_pending: bool - :ivar available_patch_count_by_classification: Summarization of patches available for - installation on the machine by classification. - :vartype available_patch_count_by_classification: - ~azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification - :ivar start_date_time: The UTC timestamp when the operation began. - :vartype start_date_time: ~datetime.datetime - :ivar last_modified_date_time: The UTC timestamp when the operation finished. - :vartype last_modified_date_time: ~datetime.datetime - :ivar started_by: Indicates if operation was triggered by user or by platform. Known values - are: "User" and "Platform". - :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy - :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: - "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". - :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed - :ivar os_type: The operating system type of the machine. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType - :ivar error_details: The errors that were encountered during execution of the operation. The - details array contains the list of them. - :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail - """ - - _validation = { - "status": {"readonly": True}, - "assessment_activity_id": {"readonly": True}, - "reboot_pending": {"readonly": True}, - "start_date_time": {"readonly": True}, - "last_modified_date_time": {"readonly": True}, - "started_by": {"readonly": True}, - "patch_service_used": {"readonly": True}, - "os_type": {"readonly": True}, - "error_details": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "assessment_activity_id": {"key": "assessmentActivityId", "type": "str"}, - "reboot_pending": {"key": "rebootPending", "type": "bool"}, - "available_patch_count_by_classification": { - "key": "availablePatchCountByClassification", - "type": "AvailablePatchCountByClassification", - }, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, - "started_by": {"key": "startedBy", "type": "str"}, - "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, - } - - def __init__( - self, - *, - available_patch_count_by_classification: Optional["_models.AvailablePatchCountByClassification"] = None, - **kwargs: Any - ) -> None: - """ - :keyword available_patch_count_by_classification: Summarization of patches available for - installation on the machine by classification. - :paramtype available_patch_count_by_classification: - ~azure.mgmt.hybridcompute.models.AvailablePatchCountByClassification - """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.assessment_activity_id: Optional[str] = None - self.reboot_pending: Optional[bool] = None - self.available_patch_count_by_classification = available_patch_count_by_classification - self.start_date_time: Optional[datetime.datetime] = None - self.last_modified_date_time: Optional[datetime.datetime] = None - self.started_by: Optional[Union[str, "_models.PatchOperationStartedBy"]] = None - self.patch_service_used: Optional[Union[str, "_models.PatchServiceUsed"]] = None - self.os_type: Optional[Union[str, "_models.OsType"]] = None - self.error_details: Optional["_models.ErrorDetail"] = None - - -class MachineExtension(TrackedResource): - """Describes a Machine Extension. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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: Describes Machine Extension Properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionProperties - """ - - _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"}, - "properties": {"key": "properties", "type": "MachineExtensionProperties"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.MachineExtensionProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword properties: Describes Machine Extension Properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.MachineExtensionProperties - """ - super().__init__(tags=tags, location=location, **kwargs) - self.properties = properties - - -class MachineExtensionInstanceView(_serialization.Model): - """Describes the Machine Extension Instance View. - - :ivar name: The machine extension name. - :vartype name: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar status: Instance view status. - :vartype status: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceViewStatus - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "status": {"key": "status", "type": "MachineExtensionInstanceViewStatus"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - status: Optional["_models.MachineExtensionInstanceViewStatus"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The machine extension name. - :paramtype name: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword status: Instance view status. - :paramtype status: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceViewStatus - """ - super().__init__(**kwargs) - self.name = name - self.type = type - self.type_handler_version = type_handler_version - self.status = status - - -class MachineExtensionInstanceViewStatus(_serialization.Model): - """Instance view status. - - :ivar code: The status code. - :vartype code: str - :ivar level: The level code. Known values are: "Info", "Warning", and "Error". - :vartype level: str or ~azure.mgmt.hybridcompute.models.StatusLevelTypes - :ivar display_status: The short localizable label for the status. - :vartype display_status: str - :ivar message: The detailed status message, including for alerts and error messages. - :vartype message: str - :ivar time: The time of the status. - :vartype time: ~datetime.datetime - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "level": {"key": "level", "type": "str"}, - "display_status": {"key": "displayStatus", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "time": {"key": "time", "type": "iso-8601"}, - } - - def __init__( - self, - *, - code: Optional[str] = None, - level: Optional[Union[str, "_models.StatusLevelTypes"]] = None, - display_status: Optional[str] = None, - message: Optional[str] = None, - time: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword code: The status code. - :paramtype code: str - :keyword level: The level code. Known values are: "Info", "Warning", and "Error". - :paramtype level: str or ~azure.mgmt.hybridcompute.models.StatusLevelTypes - :keyword display_status: The short localizable label for the status. - :paramtype display_status: str - :keyword message: The detailed status message, including for alerts and error messages. - :paramtype message: str - :keyword time: The time of the status. - :paramtype time: ~datetime.datetime - """ - super().__init__(**kwargs) - self.code = code - self.level = level - self.display_status = display_status - self.message = message - self.time = time - - -class MachineExtensionProperties(_serialization.Model): - """Describes the properties of a Machine Extension. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :vartype enable_automatic_upgrade: bool - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: dict[str, any] - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: dict[str, any] - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar instance_view: The machine extension instance view. - :vartype instance_view: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView - """ - - _validation = { - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "force_update_tag": {"key": "forceUpdateTag", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "type_handler_version": {"key": "typeHandlerVersion", "type": "str"}, - "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, - "auto_upgrade_minor_version": {"key": "autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "settings", "type": "{object}"}, - "protected_settings": {"key": "protectedSettings", "type": "{object}"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "instance_view": {"key": "instanceView", "type": "MachineExtensionInstanceView"}, - } - - def __init__( - self, - *, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[Dict[str, Any]] = None, - protected_settings: Optional[Dict[str, Any]] = None, - instance_view: Optional["_models.MachineExtensionInstanceView"] = None, - **kwargs: Any - ) -> None: - """ - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :paramtype enable_automatic_upgrade: bool - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: dict[str, any] - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: dict[str, any] - :keyword instance_view: The machine extension instance view. - :paramtype instance_view: ~azure.mgmt.hybridcompute.models.MachineExtensionInstanceView - """ - super().__init__(**kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.enable_automatic_upgrade = enable_automatic_upgrade - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.provisioning_state: Optional[str] = None - self.instance_view = instance_view - - -class MachineExtensionsListResult(_serialization.Model): - """Describes the Machine Extensions List Result. - - :ivar value: The list of extensions. - :vartype value: list[~azure.mgmt.hybridcompute.models.MachineExtension] - :ivar next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachineExtension]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.MachineExtension"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of extensions. - :paramtype value: list[~azure.mgmt.hybridcompute.models.MachineExtension] - :keyword next_link: The uri to fetch the next page of machine extensions. Call ListNext() with - this to fetch the next page of extensions. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachineExtensionUpdate(ResourceUpdate): - """Describes a Machine Extension Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :vartype force_update_tag: str - :ivar publisher: The name of the extension handler publisher. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. - :vartype type_handler_version: str - :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :vartype enable_automatic_upgrade: bool - :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :vartype auto_upgrade_minor_version: bool - :ivar settings: Json formatted public settings for the extension. - :vartype settings: dict[str, any] - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: dict[str, any] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "{object}"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "{object}"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - force_update_tag: Optional[str] = None, - publisher: Optional[str] = None, - type: Optional[str] = None, - type_handler_version: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[Dict[str, Any]] = None, - protected_settings: Optional[Dict[str, Any]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword force_update_tag: How the extension handler should be forced to update even if the - extension configuration has not changed. - :paramtype force_update_tag: str - :keyword publisher: The name of the extension handler publisher. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. - :paramtype type_handler_version: str - :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version available. - :paramtype enable_automatic_upgrade: bool - :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor - version if one is available at deployment time. Once deployed, however, the extension will not - upgrade minor versions unless redeployed, even with this property set to true. - :paramtype auto_upgrade_minor_version: bool - :keyword settings: Json formatted public settings for the extension. - :paramtype settings: dict[str, any] - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: dict[str, any] - """ - super().__init__(tags=tags, **kwargs) - self.force_update_tag = force_update_tag - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.enable_automatic_upgrade = enable_automatic_upgrade - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - - -class MachineExtensionUpgrade(_serialization.Model): - """Describes the Machine Extension Upgrade Properties. - - :ivar extension_targets: Describes the Extension Target Properties. - :vartype extension_targets: dict[str, - ~azure.mgmt.hybridcompute.models.ExtensionTargetProperties] - """ - - _attribute_map = { - "extension_targets": {"key": "extensionTargets", "type": "{ExtensionTargetProperties}"}, - } - - def __init__( - self, *, extension_targets: Optional[Dict[str, "_models.ExtensionTargetProperties"]] = None, **kwargs: Any - ) -> None: - """ - :keyword extension_targets: Describes the Extension Target Properties. - :paramtype extension_targets: dict[str, - ~azure.mgmt.hybridcompute.models.ExtensionTargetProperties] - """ - super().__init__(**kwargs) - self.extension_targets = extension_targets - - -class MachineInstallPatchesParameters(_serialization.Model): - """Input for InstallPatches as directly received by the API. - - All required parameters must be populated in order to send to server. - - :ivar maximum_duration: Specifies the maximum amount of time that the operation will run. It - must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. - :vartype maximum_duration: ~datetime.timedelta - :ivar reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :vartype reboot_setting: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting - :ivar windows_parameters: Input for InstallPatches on a Windows VM, as directly received by the - API. - :vartype windows_parameters: ~azure.mgmt.hybridcompute.models.WindowsParameters - :ivar linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :vartype linux_parameters: ~azure.mgmt.hybridcompute.models.LinuxParameters - """ - - _validation = { - "maximum_duration": {"required": True}, - "reboot_setting": {"required": True}, - } - - _attribute_map = { - "maximum_duration": {"key": "maximumDuration", "type": "duration"}, - "reboot_setting": {"key": "rebootSetting", "type": "str"}, - "windows_parameters": {"key": "windowsParameters", "type": "WindowsParameters"}, - "linux_parameters": {"key": "linuxParameters", "type": "LinuxParameters"}, - } - - def __init__( - self, - *, - maximum_duration: datetime.timedelta, - reboot_setting: Union[str, "_models.VMGuestPatchRebootSetting"], - windows_parameters: Optional["_models.WindowsParameters"] = None, - linux_parameters: Optional["_models.LinuxParameters"] = None, - **kwargs: Any - ) -> None: - """ - :keyword maximum_duration: Specifies the maximum amount of time that the operation will run. It - must be an ISO 8601-compliant duration string such as PT4H (4 hours). Required. - :paramtype maximum_duration: ~datetime.timedelta - :keyword reboot_setting: Defines when it is acceptable to reboot a VM during a software update - operation. Required. Known values are: "IfRequired", "Never", and "Always". - :paramtype reboot_setting: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootSetting - :keyword windows_parameters: Input for InstallPatches on a Windows VM, as directly received by - the API. - :paramtype windows_parameters: ~azure.mgmt.hybridcompute.models.WindowsParameters - :keyword linux_parameters: Input for InstallPatches on a Linux VM, as directly received by the - API. - :paramtype linux_parameters: ~azure.mgmt.hybridcompute.models.LinuxParameters - """ - super().__init__(**kwargs) - self.maximum_duration = maximum_duration - self.reboot_setting = reboot_setting - self.windows_parameters = windows_parameters - self.linux_parameters = linux_parameters - - -class MachineInstallPatchesResult(_serialization.Model): - """The result summary of an installation operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The overall success or failure status of the operation. It remains "InProgress" - until the operation completes. At that point it will become "Failed", "Succeeded", "Unknown" or - "CompletedWithWarnings.". Known values are: "Unknown", "InProgress", "Failed", "Succeeded", and - "CompletedWithWarnings". - :vartype status: str or ~azure.mgmt.hybridcompute.models.PatchOperationStatus - :ivar installation_activity_id: The activity ID of the operation that produced this result. - :vartype installation_activity_id: str - :ivar reboot_status: The reboot state of the VM following completion of the operation. Known - values are: "Unknown", "NotNeeded", "Required", "Started", "Failed", and "Completed". - :vartype reboot_status: str or ~azure.mgmt.hybridcompute.models.VMGuestPatchRebootStatus - :ivar maintenance_window_exceeded: Whether the operation ran out of time before it completed - all its intended actions. - :vartype maintenance_window_exceeded: bool - :ivar excluded_patch_count: The number of patches that were not installed due to the user - blocking their installation. - :vartype excluded_patch_count: int - :ivar not_selected_patch_count: The number of patches that were detected as available for - install, but did not meet the operation's criteria. - :vartype not_selected_patch_count: int - :ivar pending_patch_count: The number of patches that were identified as meeting the - installation criteria, but were not able to be installed. Typically this happens when - maintenanceWindowExceeded == true. - :vartype pending_patch_count: int - :ivar installed_patch_count: The number of patches successfully installed. - :vartype installed_patch_count: int - :ivar failed_patch_count: The number of patches that could not be installed due to some issue. - See errors for details. - :vartype failed_patch_count: int - :ivar start_date_time: The UTC timestamp when the operation began. - :vartype start_date_time: ~datetime.datetime - :ivar last_modified_date_time: The UTC timestamp when the operation finished. - :vartype last_modified_date_time: ~datetime.datetime - :ivar started_by: Indicates if operation was triggered by user or by platform. Known values - are: "User" and "Platform". - :vartype started_by: str or ~azure.mgmt.hybridcompute.models.PatchOperationStartedBy - :ivar patch_service_used: Specifies the patch service used for the operation. Known values are: - "Unknown", "WU", "WU_WSUS", "YUM", "APT", and "Zypper". - :vartype patch_service_used: str or ~azure.mgmt.hybridcompute.models.PatchServiceUsed - :ivar os_type: The operating system type of the machine. Known values are: "Windows" and - "Linux". - :vartype os_type: str or ~azure.mgmt.hybridcompute.models.OsType - :ivar error_details: The errors that were encountered during execution of the operation. The - details array contains the list of them. - :vartype error_details: ~azure.mgmt.hybridcompute.models.ErrorDetail - """ - - _validation = { - "status": {"readonly": True}, - "installation_activity_id": {"readonly": True}, - "reboot_status": {"readonly": True}, - "maintenance_window_exceeded": {"readonly": True}, - "excluded_patch_count": {"readonly": True}, - "not_selected_patch_count": {"readonly": True}, - "pending_patch_count": {"readonly": True}, - "installed_patch_count": {"readonly": True}, - "failed_patch_count": {"readonly": True}, - "start_date_time": {"readonly": True}, - "last_modified_date_time": {"readonly": True}, - "started_by": {"readonly": True}, - "patch_service_used": {"readonly": True}, - "os_type": {"readonly": True}, - "error_details": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "installation_activity_id": {"key": "installationActivityId", "type": "str"}, - "reboot_status": {"key": "rebootStatus", "type": "str"}, - "maintenance_window_exceeded": {"key": "maintenanceWindowExceeded", "type": "bool"}, - "excluded_patch_count": {"key": "excludedPatchCount", "type": "int"}, - "not_selected_patch_count": {"key": "notSelectedPatchCount", "type": "int"}, - "pending_patch_count": {"key": "pendingPatchCount", "type": "int"}, - "installed_patch_count": {"key": "installedPatchCount", "type": "int"}, - "failed_patch_count": {"key": "failedPatchCount", "type": "int"}, - "start_date_time": {"key": "startDateTime", "type": "iso-8601"}, - "last_modified_date_time": {"key": "lastModifiedDateTime", "type": "iso-8601"}, - "started_by": {"key": "startedBy", "type": "str"}, - "patch_service_used": {"key": "patchServiceUsed", "type": "str"}, - "os_type": {"key": "osType", "type": "str"}, - "error_details": {"key": "errorDetails", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status: Optional[Union[str, "_models.PatchOperationStatus"]] = None - self.installation_activity_id: Optional[str] = None - self.reboot_status: Optional[Union[str, "_models.VMGuestPatchRebootStatus"]] = None - self.maintenance_window_exceeded: Optional[bool] = None - self.excluded_patch_count: Optional[int] = None - self.not_selected_patch_count: Optional[int] = None - self.pending_patch_count: Optional[int] = None - self.installed_patch_count: Optional[int] = None - self.failed_patch_count: Optional[int] = None - self.start_date_time: Optional[datetime.datetime] = None - self.last_modified_date_time: Optional[datetime.datetime] = None - self.started_by: Optional[Union[str, "_models.PatchOperationStartedBy"]] = None - self.patch_service_used: Optional[Union[str, "_models.PatchServiceUsed"]] = None - self.os_type: Optional[Union[str, "_models.OsType"]] = None - self.error_details: Optional["_models.ErrorDetail"] = None - - -class MachineListResult(_serialization.Model): - """The List hybrid machine operation response. - - All required parameters must be populated in order to send to server. - - :ivar value: The list of hybrid machines. Required. - :vartype value: list[~azure.mgmt.hybridcompute.models.Machine] - :ivar next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI to - fetch the next page of hybrid machines. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Machine]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Machine"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of hybrid machines. Required. - :paramtype value: list[~azure.mgmt.hybridcompute.models.Machine] - :keyword next_link: The URI to fetch the next page of Machines. Call ListNext() with this URI - to fetch the next page of hybrid machines. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachineRunCommand(TrackedResource): - """Describes a Run Command. - - 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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.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 source: The source of the run command script. - :vartype source: ~azure.mgmt.hybridcompute.models.MachineRunCommandScriptSource - :ivar parameters: The parameters used by the script. - :vartype parameters: list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] - :ivar protected_parameters: The parameters used by the script. - :vartype protected_parameters: list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] - :ivar async_execution: Optional. If set to true, provisioning will complete as soon as script - starts and will not wait for script to complete. - :vartype async_execution: bool - :ivar run_as_user: Specifies the user account on the machine when executing the run command. - :vartype run_as_user: str - :ivar run_as_password: Specifies the user account password on the machine when executing the - run command. - :vartype run_as_password: str - :ivar timeout_in_seconds: The timeout in seconds to execute the run command. - :vartype timeout_in_seconds: int - :ivar output_blob_uri: Specifies the Azure storage blob where script output stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :vartype output_blob_uri: str - :ivar error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :vartype error_blob_uri: str - :ivar output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype output_blob_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - :ivar error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :vartype error_blob_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar instance_view: The machine run command instance view. - :vartype instance_view: ~azure.mgmt.hybridcompute.models.MachineRunCommandInstanceView - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "provisioning_state": {"readonly": True}, - "instance_view": {"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"}, - "source": {"key": "properties.source", "type": "MachineRunCommandScriptSource"}, - "parameters": {"key": "properties.parameters", "type": "[RunCommandInputParameter]"}, - "protected_parameters": {"key": "properties.protectedParameters", "type": "[RunCommandInputParameter]"}, - "async_execution": {"key": "properties.asyncExecution", "type": "bool"}, - "run_as_user": {"key": "properties.runAsUser", "type": "str"}, - "run_as_password": {"key": "properties.runAsPassword", "type": "str"}, - "timeout_in_seconds": {"key": "properties.timeoutInSeconds", "type": "int"}, - "output_blob_uri": {"key": "properties.outputBlobUri", "type": "str"}, - "error_blob_uri": {"key": "properties.errorBlobUri", "type": "str"}, - "output_blob_managed_identity": { - "key": "properties.outputBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "error_blob_managed_identity": { - "key": "properties.errorBlobManagedIdentity", - "type": "RunCommandManagedIdentity", - }, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "instance_view": {"key": "properties.instanceView", "type": "MachineRunCommandInstanceView"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - source: Optional["_models.MachineRunCommandScriptSource"] = None, - parameters: Optional[List["_models.RunCommandInputParameter"]] = None, - protected_parameters: Optional[List["_models.RunCommandInputParameter"]] = None, - async_execution: bool = False, - run_as_user: Optional[str] = None, - run_as_password: Optional[str] = None, - timeout_in_seconds: Optional[int] = None, - output_blob_uri: Optional[str] = None, - error_blob_uri: Optional[str] = None, - output_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - error_blob_managed_identity: Optional["_models.RunCommandManagedIdentity"] = 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 source: The source of the run command script. - :paramtype source: ~azure.mgmt.hybridcompute.models.MachineRunCommandScriptSource - :keyword parameters: The parameters used by the script. - :paramtype parameters: list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] - :keyword protected_parameters: The parameters used by the script. - :paramtype protected_parameters: - list[~azure.mgmt.hybridcompute.models.RunCommandInputParameter] - :keyword async_execution: Optional. If set to true, provisioning will complete as soon as - script starts and will not wait for script to complete. - :paramtype async_execution: bool - :keyword run_as_user: Specifies the user account on the machine when executing the run command. - :paramtype run_as_user: str - :keyword run_as_password: Specifies the user account password on the machine when executing the - run command. - :paramtype run_as_password: str - :keyword timeout_in_seconds: The timeout in seconds to execute the run command. - :paramtype timeout_in_seconds: int - :keyword output_blob_uri: Specifies the Azure storage blob where script output stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer outputBlobManagedIdentity parameter. - :paramtype output_blob_uri: str - :keyword error_blob_uri: Specifies the Azure storage blob where script error stream will be - uploaded. Use a SAS URI with read, append, create, write access OR use managed identity to - provide the VM access to the blob. Refer errorBlobManagedIdentity parameter. - :paramtype error_blob_uri: str - :keyword output_blob_managed_identity: User-assigned managed identity that has access to - outputBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype output_blob_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - :keyword error_blob_managed_identity: User-assigned managed identity that has access to - errorBlobUri storage blob. Use an empty object in case of system-assigned identity. Make sure - managed identity has been given access to blob's container with 'Storage Blob Data Contributor' - role assignment. In case of user-assigned identity, make sure you add it under VM's identity. - For more info on managed identity and Run Command, refer https://aka.ms/ManagedIdentity and - https://aka.ms/RunCommandManaged. - :paramtype error_blob_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - """ - super().__init__(tags=tags, location=location, **kwargs) - self.source = source - self.parameters = parameters - self.protected_parameters = protected_parameters - self.async_execution = async_execution - self.run_as_user = run_as_user - self.run_as_password = run_as_password - self.timeout_in_seconds = timeout_in_seconds - self.output_blob_uri = output_blob_uri - self.error_blob_uri = error_blob_uri - self.output_blob_managed_identity = output_blob_managed_identity - self.error_blob_managed_identity = error_blob_managed_identity - self.provisioning_state: Optional[str] = None - self.instance_view: Optional["_models.MachineRunCommandInstanceView"] = None - - -class MachineRunCommandInstanceView(_serialization.Model): - """The instance view of a machine run command. - - :ivar execution_state: Script execution status. Known values are: "Unknown", "Pending", - "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". - :vartype execution_state: str or ~azure.mgmt.hybridcompute.models.ExecutionState - :ivar execution_message: Communicate script configuration errors or execution messages. - :vartype execution_message: str - :ivar exit_code: Exit code returned from script execution. - :vartype exit_code: int - :ivar output: Script output stream. - :vartype output: str - :ivar error: Script error stream. - :vartype error: str - :ivar start_time: Script start time. - :vartype start_time: ~datetime.datetime - :ivar end_time: Script end time. - :vartype end_time: ~datetime.datetime - :ivar statuses: The status information. - :vartype statuses: list[~azure.mgmt.hybridcompute.models.ExtensionsResourceStatus] - """ - - _attribute_map = { - "execution_state": {"key": "executionState", "type": "str"}, - "execution_message": {"key": "executionMessage", "type": "str"}, - "exit_code": {"key": "exitCode", "type": "int"}, - "output": {"key": "output", "type": "str"}, - "error": {"key": "error", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "statuses": {"key": "statuses", "type": "[ExtensionsResourceStatus]"}, - } - - def __init__( - self, - *, - execution_state: Optional[Union[str, "_models.ExecutionState"]] = None, - execution_message: Optional[str] = None, - exit_code: Optional[int] = None, - output: Optional[str] = None, - error: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - statuses: Optional[List["_models.ExtensionsResourceStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword execution_state: Script execution status. Known values are: "Unknown", "Pending", - "Running", "Failed", "Succeeded", "TimedOut", and "Canceled". - :paramtype execution_state: str or ~azure.mgmt.hybridcompute.models.ExecutionState - :keyword execution_message: Communicate script configuration errors or execution messages. - :paramtype execution_message: str - :keyword exit_code: Exit code returned from script execution. - :paramtype exit_code: int - :keyword output: Script output stream. - :paramtype output: str - :keyword error: Script error stream. - :paramtype error: str - :keyword start_time: Script start time. - :paramtype start_time: ~datetime.datetime - :keyword end_time: Script end time. - :paramtype end_time: ~datetime.datetime - :keyword statuses: The status information. - :paramtype statuses: list[~azure.mgmt.hybridcompute.models.ExtensionsResourceStatus] - """ - super().__init__(**kwargs) - self.execution_state = execution_state - self.execution_message = execution_message - self.exit_code = exit_code - self.output = output - self.error = error - self.start_time = start_time - self.end_time = end_time - self.statuses = statuses - - -class MachineRunCommandScriptSource(_serialization.Model): - """Describes the script sources for run command. Use only one of script, scriptUri, commandId. - - :ivar script: Specifies the script content to be executed on the machine. - :vartype script: str - :ivar script_uri: Specifies the script download location. It can be either SAS URI of an Azure - storage blob with read access or public URI. - :vartype script_uri: str - :ivar command_id: Specifies the commandId of predefined built-in script. - :vartype command_id: str - :ivar script_uri_managed_identity: User-assigned managed identity that has access to scriptUri - in case of Azure storage blob. Use an empty object in case of system-assigned identity. Make - sure the Azure storage blob exists, and managed identity has been given access to blob's - container with 'Storage Blob Data Reader' role assignment. In case of user-assigned identity, - make sure you add it under VM's identity. For more info on managed identity and Run Command, - refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - :vartype script_uri_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - """ - - _attribute_map = { - "script": {"key": "script", "type": "str"}, - "script_uri": {"key": "scriptUri", "type": "str"}, - "command_id": {"key": "commandId", "type": "str"}, - "script_uri_managed_identity": {"key": "scriptUriManagedIdentity", "type": "RunCommandManagedIdentity"}, - } - - def __init__( - self, - *, - script: Optional[str] = None, - script_uri: Optional[str] = None, - command_id: Optional[str] = None, - script_uri_managed_identity: Optional["_models.RunCommandManagedIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword script: Specifies the script content to be executed on the machine. - :paramtype script: str - :keyword script_uri: Specifies the script download location. It can be either SAS URI of an - Azure storage blob with read access or public URI. - :paramtype script_uri: str - :keyword command_id: Specifies the commandId of predefined built-in script. - :paramtype command_id: str - :keyword script_uri_managed_identity: User-assigned managed identity that has access to - scriptUri in case of Azure storage blob. Use an empty object in case of system-assigned - identity. Make sure the Azure storage blob exists, and managed identity has been given access - to blob's container with 'Storage Blob Data Reader' role assignment. In case of user-assigned - identity, make sure you add it under VM's identity. For more info on managed identity and Run - Command, refer https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - :paramtype script_uri_managed_identity: - ~azure.mgmt.hybridcompute.models.RunCommandManagedIdentity - """ - super().__init__(**kwargs) - self.script = script - self.script_uri = script_uri - self.command_id = command_id - self.script_uri_managed_identity = script_uri_managed_identity - - -class MachineRunCommandsListResult(_serialization.Model): - """Describes the Run Commands List Result. - - :ivar value: The list of run commands. - :vartype value: list[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :ivar next_link: The uri to fetch the next page of run commands. Call ListNext() with this to - fetch the next page of run commands. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[MachineRunCommand]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.MachineRunCommand"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of run commands. - :paramtype value: list[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :keyword next_link: The uri to fetch the next page of run commands. Call ListNext() with this - to fetch the next page of run commands. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class MachineRunCommandUpdate(ResourceUpdate): - """Describes a Machine Extension Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - -class MachineUpdate(ResourceUpdate): - """Describes a hybrid machine Update. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Identity for the resource. - :vartype identity: ~azure.mgmt.hybridcompute.models.Identity - :ivar kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or - VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". - :vartype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum - :ivar location_data: Metadata pertaining to the geographic location of the resource. - :vartype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :ivar os_profile: Specifies the operating system settings for the hybrid machine. - :vartype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :ivar cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :vartype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :ivar agent_upgrade: The info of the machine w.r.t Agent Upgrade. - :vartype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade - :ivar parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :vartype parent_cluster_resource_id: str - :ivar private_link_scope_resource_id: The resource id of the private link scope this machine is - assigned to, if any. - :vartype private_link_scope_resource_id: str - :ivar identity_key_store: Identity key store type of the machine. - :vartype identity_key_store: str - :ivar tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) that - the client provides to be used during initial resource onboarding. - :vartype tpm_ek_certificate: str - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "Identity"}, - "kind": {"key": "kind", "type": "str"}, - "location_data": {"key": "properties.locationData", "type": "LocationData"}, - "os_profile": {"key": "properties.osProfile", "type": "OSProfile"}, - "cloud_metadata": {"key": "properties.cloudMetadata", "type": "CloudMetadata"}, - "agent_upgrade": {"key": "properties.agentUpgrade", "type": "AgentUpgrade"}, - "parent_cluster_resource_id": {"key": "properties.parentClusterResourceId", "type": "str"}, - "private_link_scope_resource_id": {"key": "properties.privateLinkScopeResourceId", "type": "str"}, - "identity_key_store": {"key": "properties.identityKeyStore", "type": "str"}, - "tpm_ek_certificate": {"key": "properties.tpmEkCertificate", "type": "str"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.Identity"] = None, - kind: Optional[Union[str, "_models.ArcKindEnum"]] = None, - location_data: Optional["_models.LocationData"] = None, - os_profile: Optional["_models.OSProfile"] = None, - cloud_metadata: Optional["_models.CloudMetadata"] = None, - agent_upgrade: Optional["_models.AgentUpgrade"] = None, - parent_cluster_resource_id: Optional[str] = None, - private_link_scope_resource_id: Optional[str] = None, - identity_key_store: Optional[str] = None, - tpm_ek_certificate: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Identity for the resource. - :paramtype identity: ~azure.mgmt.hybridcompute.models.Identity - :keyword kind: Indicates which kind of Arc machine placement on-premises, such as HCI, SCVMM or - VMware etc. Known values are: "AVS", "HCI", "SCVMM", "VMware", "EPS", "GCP", and "AWS". - :paramtype kind: str or ~azure.mgmt.hybridcompute.models.ArcKindEnum - :keyword location_data: Metadata pertaining to the geographic location of the resource. - :paramtype location_data: ~azure.mgmt.hybridcompute.models.LocationData - :keyword os_profile: Specifies the operating system settings for the hybrid machine. - :paramtype os_profile: ~azure.mgmt.hybridcompute.models.OSProfile - :keyword cloud_metadata: The metadata of the cloud environment (Azure/GCP/AWS/OCI...). - :paramtype cloud_metadata: ~azure.mgmt.hybridcompute.models.CloudMetadata - :keyword agent_upgrade: The info of the machine w.r.t Agent Upgrade. - :paramtype agent_upgrade: ~azure.mgmt.hybridcompute.models.AgentUpgrade - :keyword parent_cluster_resource_id: The resource id of the parent cluster (Azure HCI) this - machine is assigned to, if any. - :paramtype parent_cluster_resource_id: str - :keyword private_link_scope_resource_id: The resource id of the private link scope this machine - is assigned to, if any. - :paramtype private_link_scope_resource_id: str - :keyword identity_key_store: Identity key store type of the machine. - :paramtype identity_key_store: str - :keyword tpm_ek_certificate: Endorsement Key Certificate of the Trusted Platform Module (TPM) - that the client provides to be used during initial resource onboarding. - :paramtype tpm_ek_certificate: str - """ - super().__init__(tags=tags, **kwargs) - self.identity = identity - self.kind = kind - self.location_data = location_data - self.os_profile = os_profile - self.cloud_metadata = cloud_metadata - self.agent_upgrade = agent_upgrade - self.parent_cluster_resource_id = parent_cluster_resource_id - self.private_link_scope_resource_id = private_link_scope_resource_id - self.identity_key_store = identity_key_store - self.tpm_ek_certificate = tpm_ek_certificate - - -class NetworkConfiguration(ProxyResource): - """NetworkConfiguration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar location: Resource location. - :vartype location: str - :ivar tenant_id: Azure resource tenant Id. - :vartype tenant_id: str - :ivar network_configuration_scope_id: Associated Network Configuration Scope Id (GUID). - :vartype network_configuration_scope_id: str - :ivar network_configuration_scope_resource_id: Associated Network Configuration Scope Resource - Id. - :vartype network_configuration_scope_resource_id: str - :ivar key_properties: Public key information for client authentication. - :vartype key_properties: ~azure.mgmt.hybridcompute.models.KeyProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "tenant_id": {"readonly": True}, - "key_properties": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "location": {"key": "properties.location", "type": "str"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "network_configuration_scope_id": {"key": "properties.networkConfigurationScopeId", "type": "str"}, - "network_configuration_scope_resource_id": { - "key": "properties.networkConfigurationScopeResourceId", - "type": "str", - }, - "key_properties": {"key": "properties.keyProperties", "type": "KeyProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - network_configuration_scope_id: Optional[str] = None, - network_configuration_scope_resource_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location. - :paramtype location: str - :keyword network_configuration_scope_id: Associated Network Configuration Scope Id (GUID). - :paramtype network_configuration_scope_id: str - :keyword network_configuration_scope_resource_id: Associated Network Configuration Scope - Resource Id. - :paramtype network_configuration_scope_resource_id: str - """ - super().__init__(**kwargs) - self.location = location - self.tenant_id: Optional[str] = None - self.network_configuration_scope_id = network_configuration_scope_id - self.network_configuration_scope_resource_id = network_configuration_scope_resource_id - self.key_properties: Optional["_models.KeyProperties"] = None - - -class NetworkInterface(_serialization.Model): - """Describes a network interface. - - :ivar mac_address: Represents MAC address of the network interface. - :vartype mac_address: str - :ivar id: Represents the ID of the network interface. - :vartype id: str - :ivar name: Represents the name of the network interface. - :vartype name: str - :ivar ip_addresses: The list of IP addresses in this interface. - :vartype ip_addresses: list[~azure.mgmt.hybridcompute.models.IpAddress] - """ - - _attribute_map = { - "mac_address": {"key": "macAddress", "type": "str"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "ip_addresses": {"key": "ipAddresses", "type": "[IpAddress]"}, - } - - def __init__( - self, - *, - mac_address: Optional[str] = None, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - ip_addresses: Optional[List["_models.IpAddress"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword mac_address: Represents MAC address of the network interface. - :paramtype mac_address: str - :keyword id: Represents the ID of the network interface. - :paramtype id: str - :keyword name: Represents the name of the network interface. - :paramtype name: str - :keyword ip_addresses: The list of IP addresses in this interface. - :paramtype ip_addresses: list[~azure.mgmt.hybridcompute.models.IpAddress] - """ - super().__init__(**kwargs) - self.mac_address = mac_address - self.id = id - self.name = name - self.ip_addresses = ip_addresses - - -class NetworkProfile(_serialization.Model): - """Describes the network information on this machine. - - :ivar network_interfaces: The list of network interfaces. - :vartype network_interfaces: list[~azure.mgmt.hybridcompute.models.NetworkInterface] - """ - - _attribute_map = { - "network_interfaces": {"key": "networkInterfaces", "type": "[NetworkInterface]"}, - } - - def __init__(self, *, network_interfaces: Optional[List["_models.NetworkInterface"]] = None, **kwargs: Any) -> None: - """ - :keyword network_interfaces: The list of network interfaces. - :paramtype network_interfaces: list[~azure.mgmt.hybridcompute.models.NetworkInterface] - """ - super().__init__(**kwargs) - self.network_interfaces = network_interfaces - - -class NetworkSecurityPerimeter(_serialization.Model): - """Properties that define a Network Security Perimeter resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar perimeter_guid: Guid of the Network Security Perimeter. - :vartype perimeter_guid: str - :ivar location: Regional location of the perimeter. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "perimeter_guid": {"readonly": True}, - "location": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "perimeter_guid": {"key": "perimeterGuid", "type": "str"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.perimeter_guid: Optional[str] = None - self.location: Optional[str] = None - - -class NetworkSecurityPerimeterConfiguration(_serialization.Model): - """Properties that define a Network Security Perimeter resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar provisioning_state: Current state of this NetworkSecurityPerimeter: whether or not is has - been provisioned within the resource group it is defined. Users cannot change this value but - are able to read from it. Values will include Provisioning ,Succeeded, Canceled and Failed. - :vartype provisioning_state: str - :ivar provisioning_issues: Provisioning issues. - :vartype provisioning_issues: list[~azure.mgmt.hybridcompute.models.ProvisioningIssue] - :ivar network_security_perimeter: The Network Security Perimeter associated with this - configuration. - :vartype network_security_perimeter: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeter - :ivar resource_association: The Resource Association. - :vartype resource_association: ~azure.mgmt.hybridcompute.models.ResourceAssociation - :ivar profile: Network Security Perimeter profile. - :vartype profile: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "provisioning_issues": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "provisioning_issues": {"key": "properties.provisioningIssues", "type": "[ProvisioningIssue]"}, - "network_security_perimeter": { - "key": "properties.networkSecurityPerimeter", - "type": "NetworkSecurityPerimeter", - }, - "resource_association": {"key": "properties.resourceAssociation", "type": "ResourceAssociation"}, - "profile": {"key": "properties.profile", "type": "NetworkSecurityPerimeterProfile"}, - } - - def __init__( - self, - *, - network_security_perimeter: Optional["_models.NetworkSecurityPerimeter"] = None, - resource_association: Optional["_models.ResourceAssociation"] = None, - profile: Optional["_models.NetworkSecurityPerimeterProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword network_security_perimeter: The Network Security Perimeter associated with this - configuration. - :paramtype network_security_perimeter: - ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeter - :keyword resource_association: The Resource Association. - :paramtype resource_association: ~azure.mgmt.hybridcompute.models.ResourceAssociation - :keyword profile: Network Security Perimeter profile. - :paramtype profile: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterProfile - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.provisioning_state: Optional[str] = None - self.provisioning_issues: Optional[List["_models.ProvisioningIssue"]] = None - self.network_security_perimeter = network_security_perimeter - self.resource_association = resource_association - self.profile = profile - - -class NetworkSecurityPerimeterConfigurationListResult(_serialization.Model): # pylint: disable=name-too-long - """A list of network security perimeter configurations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[NetworkSecurityPerimeterConfiguration]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.NetworkSecurityPerimeterConfiguration"]] = None - self.next_link: Optional[str] = None - - -class NetworkSecurityPerimeterConfigurationReconcileResult(_serialization.Model): # pylint: disable=name-too-long - """Result of network security perimeter configurations. - - :ivar location: The URL of the resource used to check the status of the asynchronous operation. - :vartype location: str - """ - - _attribute_map = { - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: The URL of the resource used to check the status of the asynchronous - operation. - :paramtype location: str - """ - super().__init__(**kwargs) - self.location = location - - -class NetworkSecurityPerimeterProfile(_serialization.Model): - """Network Security Perimeter profile. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the resource. - :vartype name: str - :ivar access_rules_version: Access rules version number. - :vartype access_rules_version: int - :ivar access_rules: Collection of access rules for the profile. - :vartype access_rules: list[~azure.mgmt.hybridcompute.models.AccessRule] - :ivar diagnostic_settings_version: Diagnostic settings version number. - :vartype diagnostic_settings_version: int - :ivar enabled_log_categories: Collection of enabled log categories for the profile. - :vartype enabled_log_categories: list[str] - """ - - _validation = { - "name": {"readonly": True}, - "access_rules_version": {"readonly": True}, - "access_rules": {"readonly": True}, - "diagnostic_settings_version": {"readonly": True}, - "enabled_log_categories": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_rules_version": {"key": "accessRulesVersion", "type": "int"}, - "access_rules": {"key": "accessRules", "type": "[AccessRule]"}, - "diagnostic_settings_version": {"key": "diagnosticSettingsVersion", "type": "int"}, - "enabled_log_categories": {"key": "enabledLogCategories", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.access_rules_version: Optional[int] = None - self.access_rules: Optional[List["_models.AccessRule"]] = None - self.diagnostic_settings_version: Optional[int] = None - self.enabled_log_categories: Optional[List[str]] = None - - -class OperationListResult(_serialization.Model): - """The List Compute Operation operation response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of compute operations. - :vartype value: list[~azure.mgmt.hybridcompute.models.OperationValue] - """ - - _validation = { - "value": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OperationValue]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.OperationValue"]] = None - - -class OperationValue(_serialization.Model): - """Describes the properties of a Compute Operation value. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar origin: The origin of the compute operation. - :vartype origin: str - :ivar name: The name of the compute operation. - :vartype name: str - :ivar display: Display properties. - :vartype display: ~azure.mgmt.hybridcompute.models.OperationValueDisplay - :ivar is_data_action: This property indicates if the operation is an action or a data action. - :vartype is_data_action: bool - """ - - _validation = { - "origin": {"readonly": True}, - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - } - - _attribute_map = { - "origin": {"key": "origin", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "display": {"key": "display", "type": "OperationValueDisplay"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - } - - def __init__(self, *, display: Optional["_models.OperationValueDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Display properties. - :paramtype display: ~azure.mgmt.hybridcompute.models.OperationValueDisplay - """ - super().__init__(**kwargs) - self.origin: Optional[str] = None - self.name: Optional[str] = None - self.display = display - self.is_data_action: Optional[bool] = None - - -class OperationValueDisplay(_serialization.Model): - """Describes the properties of a Hybrid Compute Operation Value Display. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar operation: The display name of the compute operation. - :vartype operation: str - :ivar resource: The display name of the resource the operation applies to. - :vartype resource: str - :ivar description: The description of the operation. - :vartype description: str - :ivar provider: The resource provider for the operation. - :vartype provider: str - """ - - _validation = { - "operation": {"readonly": True}, - "resource": {"readonly": True}, - "description": {"readonly": True}, - "provider": {"readonly": True}, - } - - _attribute_map = { - "operation": {"key": "operation", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "provider": {"key": "provider", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.operation: Optional[str] = None - self.resource: Optional[str] = None - self.description: Optional[str] = None - self.provider: Optional[str] = None - - -class OSProfile(_serialization.Model): - """Specifies the operating system settings for the hybrid machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar computer_name: Specifies the host OS name of the hybrid machine. - :vartype computer_name: str - :ivar windows_configuration: Specifies the windows configuration for update management. - :vartype windows_configuration: ~azure.mgmt.hybridcompute.models.OSProfileWindowsConfiguration - :ivar linux_configuration: Specifies the linux configuration for update management. - :vartype linux_configuration: ~azure.mgmt.hybridcompute.models.OSProfileLinuxConfiguration - """ - - _validation = { - "computer_name": {"readonly": True}, - } - - _attribute_map = { - "computer_name": {"key": "computerName", "type": "str"}, - "windows_configuration": {"key": "windowsConfiguration", "type": "OSProfileWindowsConfiguration"}, - "linux_configuration": {"key": "linuxConfiguration", "type": "OSProfileLinuxConfiguration"}, - } - - def __init__( - self, - *, - windows_configuration: Optional["_models.OSProfileWindowsConfiguration"] = None, - linux_configuration: Optional["_models.OSProfileLinuxConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword windows_configuration: Specifies the windows configuration for update management. - :paramtype windows_configuration: - ~azure.mgmt.hybridcompute.models.OSProfileWindowsConfiguration - :keyword linux_configuration: Specifies the linux configuration for update management. - :paramtype linux_configuration: ~azure.mgmt.hybridcompute.models.OSProfileLinuxConfiguration - """ - super().__init__(**kwargs) - self.computer_name: Optional[str] = None - self.windows_configuration = windows_configuration - self.linux_configuration = linux_configuration - - -class OSProfileLinuxConfiguration(_serialization.Model): - """Specifies the linux configuration for update management. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assessment_mode: Specifies the assessment mode. Known values are: "ImageDefault" and - "AutomaticByPlatform". - :vartype assessment_mode: str or ~azure.mgmt.hybridcompute.models.AssessmentModeTypes - :ivar patch_mode: Specifies the patch mode. Known values are: "ImageDefault", - "AutomaticByPlatform", "AutomaticByOS", and "Manual". - :vartype patch_mode: str or ~azure.mgmt.hybridcompute.models.PatchModeTypes - :ivar enable_hotpatching: Captures the hotpatch capability enrollment intent of the customers, - which enables customers to patch their Windows machines without requiring a reboot. - :vartype enable_hotpatching: bool - :ivar status: Status of the hotpatch capability enrollment or disenrollment. - :vartype status: ~azure.mgmt.hybridcompute.models.PatchSettingsStatus - """ - - _validation = { - "status": {"readonly": True}, - } - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - "enable_hotpatching": {"key": "patchSettings.enableHotpatching", "type": "bool"}, - "status": {"key": "patchSettings.status", "type": "PatchSettingsStatus"}, - } - - def __init__( - self, - *, - assessment_mode: Optional[Union[str, "_models.AssessmentModeTypes"]] = None, - patch_mode: Optional[Union[str, "_models.PatchModeTypes"]] = None, - enable_hotpatching: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword assessment_mode: Specifies the assessment mode. Known values are: "ImageDefault" and - "AutomaticByPlatform". - :paramtype assessment_mode: str or ~azure.mgmt.hybridcompute.models.AssessmentModeTypes - :keyword patch_mode: Specifies the patch mode. Known values are: "ImageDefault", - "AutomaticByPlatform", "AutomaticByOS", and "Manual". - :paramtype patch_mode: str or ~azure.mgmt.hybridcompute.models.PatchModeTypes - :keyword enable_hotpatching: Captures the hotpatch capability enrollment intent of the - customers, which enables customers to patch their Windows machines without requiring a reboot. - :paramtype enable_hotpatching: bool - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode - self.enable_hotpatching = enable_hotpatching - self.status: Optional["_models.PatchSettingsStatus"] = None - - -class OSProfileWindowsConfiguration(_serialization.Model): - """Specifies the windows configuration for update management. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar assessment_mode: Specifies the assessment mode. Known values are: "ImageDefault" and - "AutomaticByPlatform". - :vartype assessment_mode: str or ~azure.mgmt.hybridcompute.models.AssessmentModeTypes - :ivar patch_mode: Specifies the patch mode. Known values are: "ImageDefault", - "AutomaticByPlatform", "AutomaticByOS", and "Manual". - :vartype patch_mode: str or ~azure.mgmt.hybridcompute.models.PatchModeTypes - :ivar enable_hotpatching: Captures the hotpatch capability enrollment intent of the customers, - which enables customers to patch their Windows machines without requiring a reboot. - :vartype enable_hotpatching: bool - :ivar status: Status of the hotpatch capability enrollment or disenrollment. - :vartype status: ~azure.mgmt.hybridcompute.models.PatchSettingsStatus - """ - - _validation = { - "status": {"readonly": True}, - } - - _attribute_map = { - "assessment_mode": {"key": "patchSettings.assessmentMode", "type": "str"}, - "patch_mode": {"key": "patchSettings.patchMode", "type": "str"}, - "enable_hotpatching": {"key": "patchSettings.enableHotpatching", "type": "bool"}, - "status": {"key": "patchSettings.status", "type": "PatchSettingsStatus"}, - } - - def __init__( - self, - *, - assessment_mode: Optional[Union[str, "_models.AssessmentModeTypes"]] = None, - patch_mode: Optional[Union[str, "_models.PatchModeTypes"]] = None, - enable_hotpatching: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword assessment_mode: Specifies the assessment mode. Known values are: "ImageDefault" and - "AutomaticByPlatform". - :paramtype assessment_mode: str or ~azure.mgmt.hybridcompute.models.AssessmentModeTypes - :keyword patch_mode: Specifies the patch mode. Known values are: "ImageDefault", - "AutomaticByPlatform", "AutomaticByOS", and "Manual". - :paramtype patch_mode: str or ~azure.mgmt.hybridcompute.models.PatchModeTypes - :keyword enable_hotpatching: Captures the hotpatch capability enrollment intent of the - customers, which enables customers to patch their Windows machines without requiring a reboot. - :paramtype enable_hotpatching: bool - """ - super().__init__(**kwargs) - self.assessment_mode = assessment_mode - self.patch_mode = patch_mode - self.enable_hotpatching = enable_hotpatching - self.status: Optional["_models.PatchSettingsStatus"] = None - - -class PatchSettingsStatus(_serialization.Model): - """Status of the hotpatch capability enrollment or disenrollment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar hotpatch_enablement_status: Indicates the current status of the hotpatch being enabled or - disabled. Known values are: "Unknown", "PendingEvaluation", "Disabled", "ActionRequired", and - "Enabled". - :vartype hotpatch_enablement_status: str or - ~azure.mgmt.hybridcompute.models.HotpatchEnablementStatus - :ivar error: The errors that were encountered during the hotpatch capability enrollment or - disenrollment. - :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail - """ - - _validation = { - "error": {"readonly": True}, - } - - _attribute_map = { - "hotpatch_enablement_status": {"key": "hotpatchEnablementStatus", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__( - self, - *, - hotpatch_enablement_status: Optional[Union[str, "_models.HotpatchEnablementStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword hotpatch_enablement_status: Indicates the current status of the hotpatch being enabled - or disabled. Known values are: "Unknown", "PendingEvaluation", "Disabled", "ActionRequired", - and "Enabled". - :paramtype hotpatch_enablement_status: str or - ~azure.mgmt.hybridcompute.models.HotpatchEnablementStatus - """ - super().__init__(**kwargs) - self.hotpatch_enablement_status = hotpatch_enablement_status - self.error: Optional["_models.ErrorDetail"] = None - - -class PrivateEndpointConnection(ProxyResource): - """A private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: Resource properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PrivateEndpointConnectionDataModel(_serialization.Model): - """The Data Model for a Private Endpoint Connection associated with a Private Link Scope. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: The ARM Resource Id of the Private Endpoint. - :vartype id: str - :ivar name: The Name of the Private Endpoint. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar properties: The Private Endpoint Connection properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "properties": {"key": "properties", "type": "PrivateEndpointConnectionProperties"}, - } - - def __init__( - self, *, properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, **kwargs: Any - ) -> None: - """ - :keyword properties: The Private Endpoint Connection properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.PrivateEndpointConnectionProperties - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.name: Optional[str] = None - self.type: Optional[str] = None - self.properties = properties - - -class PrivateEndpointConnectionListResult(_serialization.Model): - """A list of private endpoint connections. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateEndpointConnection]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateEndpointConnection"]] = None - self.next_link: Optional[str] = None - - -class PrivateEndpointConnectionProperties(_serialization.Model): - """Properties of a private endpoint connection. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar private_endpoint: Private endpoint which the connection belongs to. - :vartype private_endpoint: ~azure.mgmt.hybridcompute.models.PrivateEndpointProperty - :ivar private_link_service_connection_state: Connection state of the private endpoint - connection. - :vartype private_link_service_connection_state: - ~azure.mgmt.hybridcompute.models.PrivateLinkServiceConnectionStateProperty - :ivar provisioning_state: State of the private endpoint connection. - :vartype provisioning_state: str - :ivar group_ids: List of group IDs. - :vartype group_ids: list[str] - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "group_ids": {"readonly": True}, - } - - _attribute_map = { - "private_endpoint": {"key": "privateEndpoint", "type": "PrivateEndpointProperty"}, - "private_link_service_connection_state": { - "key": "privateLinkServiceConnectionState", - "type": "PrivateLinkServiceConnectionStateProperty", - }, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "group_ids": {"key": "groupIds", "type": "[str]"}, - } - - def __init__( - self, - *, - private_endpoint: Optional["_models.PrivateEndpointProperty"] = None, - private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None, - **kwargs: Any - ) -> None: - """ - :keyword private_endpoint: Private endpoint which the connection belongs to. - :paramtype private_endpoint: ~azure.mgmt.hybridcompute.models.PrivateEndpointProperty - :keyword private_link_service_connection_state: Connection state of the private endpoint - connection. - :paramtype private_link_service_connection_state: - ~azure.mgmt.hybridcompute.models.PrivateLinkServiceConnectionStateProperty - """ - super().__init__(**kwargs) - self.private_endpoint = private_endpoint - self.private_link_service_connection_state = private_link_service_connection_state - self.provisioning_state: Optional[str] = None - self.group_ids: Optional[List[str]] = None - - -class PrivateEndpointProperty(_serialization.Model): - """Private endpoint which the connection belongs to. - - :ivar id: Resource id of the private endpoint. - :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: Resource id of the private endpoint. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -class PrivateLinkResource(ProxyResource): - """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. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar properties: Resource properties. - :vartype properties: ~azure.mgmt.hybridcompute.models.PrivateLinkResourceProperties - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "PrivateLinkResourceProperties"}, - } - - def __init__(self, *, properties: Optional["_models.PrivateLinkResourceProperties"] = None, **kwargs: Any) -> None: - """ - :keyword properties: Resource properties. - :paramtype properties: ~azure.mgmt.hybridcompute.models.PrivateLinkResourceProperties - """ - super().__init__(**kwargs) - self.properties = properties - - -class PrivateLinkResourceListResult(_serialization.Model): - """A list of private link resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: Array of results. - :vartype value: list[~azure.mgmt.hybridcompute.models.PrivateLinkResource] - :ivar next_link: Link to retrieve next page of results. - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[PrivateLinkResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value: Optional[List["_models.PrivateLinkResource"]] = None - self.next_link: Optional[str] = None - - -class PrivateLinkResourceProperties(_serialization.Model): - """Properties of a private link resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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: Required DNS zone names of the the private link resource. - :vartype required_zone_names: list[str] - """ - - _validation = { - "group_id": {"readonly": True}, - "required_members": {"readonly": True}, - "required_zone_names": {"readonly": True}, - } - - _attribute_map = { - "group_id": {"key": "groupId", "type": "str"}, - "required_members": {"key": "requiredMembers", "type": "[str]"}, - "required_zone_names": {"key": "requiredZoneNames", "type": "[str]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.group_id: Optional[str] = None - self.required_members: Optional[List[str]] = None - self.required_zone_names: Optional[List[str]] = None - - -class PrivateLinkScopeValidationDetails(_serialization.Model): - """PrivateLinkScopeValidationDetails. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource Id. - :vartype id: str - :ivar public_network_access: Indicates whether machines associated with the private link scope - can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", and - "SecuredByPerimeter". - :vartype public_network_access: str or ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType - :ivar connection_details: List of Private Endpoint Connection details. - :vartype connection_details: list[~azure.mgmt.hybridcompute.models.ConnectionDetail] - """ - - _validation = { - "id": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "public_network_access": {"key": "publicNetworkAccess", "type": "str"}, - "connection_details": {"key": "connectionDetails", "type": "[ConnectionDetail]"}, - } - - def __init__( - self, - *, - public_network_access: Union[str, "_models.PublicNetworkAccessType"] = "Disabled", - connection_details: Optional[List["_models.ConnectionDetail"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword public_network_access: Indicates whether machines associated with the private link - scope can also use public Azure Arc service endpoints. Known values are: "Enabled", "Disabled", - and "SecuredByPerimeter". - :paramtype public_network_access: str or - ~azure.mgmt.hybridcompute.models.PublicNetworkAccessType - :keyword connection_details: List of Private Endpoint Connection details. - :paramtype connection_details: list[~azure.mgmt.hybridcompute.models.ConnectionDetail] - """ - super().__init__(**kwargs) - self.id: Optional[str] = None - self.public_network_access = public_network_access - self.connection_details = connection_details - - -class PrivateLinkServiceConnectionStateProperty(_serialization.Model): # pylint: disable=name-too-long - """State of the private endpoint connection. - - 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 status: The private link service connection status. Required. - :vartype status: str - :ivar description: The private link service connection description. Required. - :vartype description: str - :ivar actions_required: The actions required for private link service connection. - :vartype actions_required: str - """ - - _validation = { - "status": {"required": True}, - "description": {"required": True}, - "actions_required": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "actions_required": {"key": "actionsRequired", "type": "str"}, - } - - def __init__(self, *, status: str, description: str, **kwargs: Any) -> None: - """ - :keyword status: The private link service connection status. Required. - :paramtype status: str - :keyword description: The private link service connection description. Required. - :paramtype description: str - """ - super().__init__(**kwargs) - self.status = status - self.description = description - self.actions_required: Optional[str] = None - - -class Processor(_serialization.Model): - """Describes the firmware of the machine. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the processor. - :vartype name: str - :ivar number_of_cores: The total number of physical cores on the processor. - :vartype number_of_cores: int - """ - - _validation = { - "name": {"readonly": True}, - "number_of_cores": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "number_of_cores": {"key": "numberOfCores", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.number_of_cores: Optional[int] = None - - -class ProductFeature(_serialization.Model): - """Product Feature. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Product feature name. - :vartype name: str - :ivar subscription_status: Indicates the current status of the product features. Known values - are: "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :vartype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - :ivar enrollment_date: The timestamp in UTC when the user enrolls the feature. - :vartype enrollment_date: ~datetime.datetime - :ivar billing_start_date: The timestamp in UTC when the billing starts. - :vartype billing_start_date: ~datetime.datetime - :ivar disenrollment_date: The timestamp in UTC when the user disenrolled the feature. - :vartype disenrollment_date: ~datetime.datetime - :ivar billing_end_date: The timestamp in UTC when the billing ends. - :vartype billing_end_date: ~datetime.datetime - :ivar error: The errors that were encountered during the feature enrollment or disenrollment. - :vartype error: ~azure.mgmt.hybridcompute.models.ErrorDetail - """ - - _validation = { - "enrollment_date": {"readonly": True}, - "billing_start_date": {"readonly": True}, - "disenrollment_date": {"readonly": True}, - "billing_end_date": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "subscription_status": {"key": "subscriptionStatus", "type": "str"}, - "enrollment_date": {"key": "enrollmentDate", "type": "iso-8601"}, - "billing_start_date": {"key": "billingStartDate", "type": "iso-8601"}, - "disenrollment_date": {"key": "disenrollmentDate", "type": "iso-8601"}, - "billing_end_date": {"key": "billingEndDate", "type": "iso-8601"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatus"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Product feature name. - :paramtype name: str - :keyword subscription_status: Indicates the current status of the product features. Known - values are: "Unknown", "Enabling", "Enabled", "Disabled", "Disabling", and "Failed". - :paramtype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatus - """ - super().__init__(**kwargs) - self.name = name - self.subscription_status = subscription_status - self.enrollment_date: Optional[datetime.datetime] = None - self.billing_start_date: Optional[datetime.datetime] = None - self.disenrollment_date: Optional[datetime.datetime] = None - self.billing_end_date: Optional[datetime.datetime] = None - self.error: Optional["_models.ErrorDetail"] = None - - -class ProductFeatureUpdate(_serialization.Model): - """Product Feature. - - :ivar name: Product feature name. - :vartype name: str - :ivar subscription_status: Indicates the new status of the product feature. Known values are: - "Enable" and "Disable". - :vartype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "subscription_status": {"key": "subscriptionStatus", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - subscription_status: Optional[Union[str, "_models.LicenseProfileSubscriptionStatusUpdate"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Product feature name. - :paramtype name: str - :keyword subscription_status: Indicates the new status of the product feature. Known values - are: "Enable" and "Disable". - :paramtype subscription_status: str or - ~azure.mgmt.hybridcompute.models.LicenseProfileSubscriptionStatusUpdate - """ - super().__init__(**kwargs) - self.name = name - self.subscription_status = subscription_status - - -class ProvisioningIssue(_serialization.Model): - """Details on issues that occurred during provisioning. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the provisioning issue. - :vartype name: str - :ivar issue_type: Issue type. Known values are: "MissingPerimeterConfiguration", - "MissingIdentityConfiguration", "ConfigurationPropagationFailure", and "Other". - :vartype issue_type: str or ~azure.mgmt.hybridcompute.models.ProvisioningIssueType - :ivar severity: Severity of the provisioning issue. Known values are: "Warning" and "Error". - :vartype severity: str or ~azure.mgmt.hybridcompute.models.ProvisioningIssueSeverity - :ivar description: Description of the provisioning issue. - :vartype description: str - :ivar suggested_resource_ids: ARM Ids of the resources that can be associated to the same - perimeter to remediate the issue. - :vartype suggested_resource_ids: list[str] - :ivar suggested_access_rules: Access rules that can be added to the perimeter to remediate the - issue. - :vartype suggested_access_rules: list[~azure.mgmt.hybridcompute.models.AccessRule] - """ - - _validation = { - "name": {"readonly": True}, - "issue_type": {"readonly": True}, - "severity": {"readonly": True}, - "description": {"readonly": True}, - "suggested_resource_ids": {"readonly": True}, - "suggested_access_rules": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "issue_type": {"key": "properties.issueType", "type": "str"}, - "severity": {"key": "properties.severity", "type": "str"}, - "description": {"key": "properties.description", "type": "str"}, - "suggested_resource_ids": {"key": "properties.suggestedResourceIds", "type": "[str]"}, - "suggested_access_rules": {"key": "properties.suggestedAccessRules", "type": "[AccessRule]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.issue_type: Optional[Union[str, "_models.ProvisioningIssueType"]] = None - self.severity: Optional[Union[str, "_models.ProvisioningIssueSeverity"]] = None - self.description: Optional[str] = None - self.suggested_resource_ids: Optional[List[str]] = None - self.suggested_access_rules: Optional[List["_models.AccessRule"]] = None - - -class ResourceAssociation(_serialization.Model): - """Properties that define a Resource Association. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: Name of the Resource Association. - :vartype name: str - :ivar access_mode: The access mode. Known values are: "enforced", "audit", and "learning". - :vartype access_mode: str or ~azure.mgmt.hybridcompute.models.AccessMode - """ - - _validation = { - "name": {"readonly": True}, - "access_mode": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "access_mode": {"key": "accessMode", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name: Optional[str] = None - self.access_mode: Optional[Union[str, "_models.AccessMode"]] = None - - -class RunCommandInputParameter(_serialization.Model): - """Describes the properties of a run command parameter. - - All required parameters must be populated in order to send to server. - - :ivar name: The run command parameter name. Required. - :vartype name: str - :ivar value: The run command parameter value. Required. - :vartype value: str - """ - - _validation = { - "name": {"required": True}, - "value": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } - - def __init__(self, *, name: str, value: str, **kwargs: Any) -> None: - """ - :keyword name: The run command parameter name. Required. - :paramtype name: str - :keyword value: The run command parameter value. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class RunCommandManagedIdentity(_serialization.Model): - """Contains clientId or objectId (use only one, not both) of a user-assigned managed identity that - has access to storage blob used in Run Command. Use an empty RunCommandManagedIdentity object - in case of system-assigned identity. Make sure the Azure storage blob exists in case of - scriptUri, and managed identity has been given access to blob's container with 'Storage Blob - Data Reader' role assignment with scriptUri blob and 'Storage Blob Data Contributor' for Append - blobs(outputBlobUri, errorBlobUri). In case of user assigned identity, make sure you add it - under VM's identity. For more info on managed identity and Run Command, refer - https://aka.ms/ManagedIdentity and https://aka.ms/RunCommandManaged. - - :ivar client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId should - not be used if this is provided. - :vartype client_id: str - :ivar object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId should - not be used if this is provided. - :vartype object_id: str - """ - - _attribute_map = { - "client_id": {"key": "clientId", "type": "str"}, - "object_id": {"key": "objectId", "type": "str"}, - } - - def __init__(self, *, client_id: Optional[str] = None, object_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword client_id: Client Id (GUID value) of the user-assigned managed identity. ObjectId - should not be used if this is provided. - :paramtype client_id: str - :keyword object_id: Object Id (GUID value) of the user-assigned managed identity. ClientId - should not be used if this is provided. - :paramtype object_id: str - """ - super().__init__(**kwargs) - self.client_id = client_id - self.object_id = object_id - - -class ServiceStatus(_serialization.Model): - """Describes the status and behavior of a service. - - :ivar status: The current status of the service. - :vartype status: str - :ivar startup_type: The behavior of the service when the Arc-enabled machine starts up. - :vartype startup_type: str - """ - - _attribute_map = { - "status": {"key": "status", "type": "str"}, - "startup_type": {"key": "startupType", "type": "str"}, - } - - def __init__(self, *, status: Optional[str] = None, startup_type: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword status: The current status of the service. - :paramtype status: str - :keyword startup_type: The behavior of the service when the Arc-enabled machine starts up. - :paramtype startup_type: str - """ - super().__init__(**kwargs) - self.status = status - self.startup_type = startup_type - - -class ServiceStatuses(_serialization.Model): - """Reports the state and behavior of dependent services. - - :ivar extension_service: The state of the extension service on the Arc-enabled machine. - :vartype extension_service: ~azure.mgmt.hybridcompute.models.ServiceStatus - :ivar guest_configuration_service: The state of the guest configuration service on the - Arc-enabled machine. - :vartype guest_configuration_service: ~azure.mgmt.hybridcompute.models.ServiceStatus - """ - - _attribute_map = { - "extension_service": {"key": "extensionService", "type": "ServiceStatus"}, - "guest_configuration_service": {"key": "guestConfigurationService", "type": "ServiceStatus"}, - } - - def __init__( - self, - *, - extension_service: Optional["_models.ServiceStatus"] = None, - guest_configuration_service: Optional["_models.ServiceStatus"] = None, - **kwargs: Any - ) -> None: - """ - :keyword extension_service: The state of the extension service on the Arc-enabled machine. - :paramtype extension_service: ~azure.mgmt.hybridcompute.models.ServiceStatus - :keyword guest_configuration_service: The state of the guest configuration service on the - Arc-enabled machine. - :paramtype guest_configuration_service: ~azure.mgmt.hybridcompute.models.ServiceStatus - """ - super().__init__(**kwargs) - self.extension_service = extension_service - self.guest_configuration_service = guest_configuration_service - - -class Settings(ProxyResource): - """Settings. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.hybridcompute.models.SystemData - :ivar tenant_id: Azure resource tenant Id. - :vartype tenant_id: str - :ivar gateway_resource_id: Associated Gateway Resource Id. - :vartype gateway_resource_id: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "tenant_id": {"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"}, - "tenant_id": {"key": "properties.tenantId", "type": "str"}, - "gateway_resource_id": {"key": "properties.gatewayProperties.gatewayResourceId", "type": "str"}, - } - - def __init__(self, *, gateway_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword gateway_resource_id: Associated Gateway Resource Id. - :paramtype gateway_resource_id: str - """ - super().__init__(**kwargs) - self.tenant_id: Optional[str] = None - self.gateway_resource_id = gateway_resource_id - - -class SetupExtensionRequest(_serialization.Model): - """SetupExtensionRequest. - - :ivar extensions: The list of extensions. - :vartype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionProperties] - """ - - _attribute_map = { - "extensions": {"key": "extensions", "type": "[MachineExtensionProperties]"}, - } - - def __init__( - self, *, extensions: Optional[List["_models.MachineExtensionProperties"]] = None, **kwargs: Any - ) -> None: - """ - :keyword extensions: The list of extensions. - :paramtype extensions: list[~azure.mgmt.hybridcompute.models.MachineExtensionProperties] - """ - super().__init__(**kwargs) - self.extensions = extensions - - -class StorageProfile(_serialization.Model): - """Describes the storage configuration of the machine. - - :ivar disks: The disks on the machine. - :vartype disks: list[~azure.mgmt.hybridcompute.models.Disk] - """ - - _attribute_map = { - "disks": {"key": "disks", "type": "[Disk]"}, - } - - def __init__(self, *, disks: Optional[List["_models.Disk"]] = None, **kwargs: Any) -> None: - """ - :keyword disks: The disks on the machine. - :paramtype disks: list[~azure.mgmt.hybridcompute.models.Disk] - """ - super().__init__(**kwargs) - self.disks = disks - - -class Subnet(_serialization.Model): - """Describes the subnet. - - :ivar address_prefix: Represents address prefix. - :vartype address_prefix: str - """ - - _attribute_map = { - "address_prefix": {"key": "addressPrefix", "type": "str"}, - } - - def __init__(self, *, address_prefix: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword address_prefix: Represents address prefix. - :paramtype address_prefix: str - """ - super().__init__(**kwargs) - self.address_prefix = address_prefix - - -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.hybridcompute.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.hybridcompute.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.hybridcompute.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.hybridcompute.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 TagsResource(_serialization.Model): - """A container holding only the Tags for a resource, allowing the user to update the tags on a - PrivateLinkScope instance. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class VolumeLicenseDetails(_serialization.Model): - """VolumeLicenseDetails. - - :ivar program_year: Describes the program year the volume license is for. Known values are: - "Year 1", "Year 2", and "Year 3". - :vartype program_year: str or ~azure.mgmt.hybridcompute.models.ProgramYear - :ivar invoice_id: The invoice id for the volume license. - :vartype invoice_id: str - """ - - _attribute_map = { - "program_year": {"key": "programYear", "type": "str"}, - "invoice_id": {"key": "invoiceId", "type": "str"}, - } - - def __init__( - self, - *, - program_year: Optional[Union[str, "_models.ProgramYear"]] = None, - invoice_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword program_year: Describes the program year the volume license is for. Known values are: - "Year 1", "Year 2", and "Year 3". - :paramtype program_year: str or ~azure.mgmt.hybridcompute.models.ProgramYear - :keyword invoice_id: The invoice id for the volume license. - :paramtype invoice_id: str - """ - super().__init__(**kwargs) - self.program_year = program_year - self.invoice_id = invoice_id - - -class WindowsParameters(_serialization.Model): - """Input for InstallPatches on a Windows VM, as directly received by the API. - - :ivar classifications_to_include: The update classifications to select when installing patches - for Windows. - :vartype classifications_to_include: list[str or - ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows] - :ivar kb_numbers_to_include: Kbs to include in the patch operation. - :vartype kb_numbers_to_include: list[str] - :ivar kb_numbers_to_exclude: Kbs to exclude in the patch operation. - :vartype kb_numbers_to_exclude: list[str] - :ivar exclude_kbs_requiring_reboot: Filters out Kbs that don't have an - InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :vartype exclude_kbs_requiring_reboot: bool - :ivar max_patch_publish_date: This is used to install patches that were published on or before - this given max published date. - :vartype max_patch_publish_date: ~datetime.datetime - :ivar patch_name_masks_to_include: This is used to include patches that match the given patch - name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :vartype patch_name_masks_to_include: list[str] - :ivar patch_name_masks_to_exclude: This is used to exclude patches that match the given patch - name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :vartype patch_name_masks_to_exclude: list[str] - """ - - _attribute_map = { - "classifications_to_include": {"key": "classificationsToInclude", "type": "[str]"}, - "kb_numbers_to_include": {"key": "kbNumbersToInclude", "type": "[str]"}, - "kb_numbers_to_exclude": {"key": "kbNumbersToExclude", "type": "[str]"}, - "exclude_kbs_requiring_reboot": {"key": "excludeKbsRequiringReboot", "type": "bool"}, - "max_patch_publish_date": {"key": "maxPatchPublishDate", "type": "iso-8601"}, - "patch_name_masks_to_include": {"key": "patchNameMasksToInclude", "type": "[str]"}, - "patch_name_masks_to_exclude": {"key": "patchNameMasksToExclude", "type": "[str]"}, - } - - def __init__( - self, - *, - classifications_to_include: Optional[List[Union[str, "_models.VMGuestPatchClassificationWindows"]]] = None, - kb_numbers_to_include: Optional[List[str]] = None, - kb_numbers_to_exclude: Optional[List[str]] = None, - exclude_kbs_requiring_reboot: Optional[bool] = None, - max_patch_publish_date: Optional[datetime.datetime] = None, - patch_name_masks_to_include: Optional[List[str]] = None, - patch_name_masks_to_exclude: Optional[List[str]] = None, - **kwargs: Any - ) -> None: - """ - :keyword classifications_to_include: The update classifications to select when installing - patches for Windows. - :paramtype classifications_to_include: list[str or - ~azure.mgmt.hybridcompute.models.VMGuestPatchClassificationWindows] - :keyword kb_numbers_to_include: Kbs to include in the patch operation. - :paramtype kb_numbers_to_include: list[str] - :keyword kb_numbers_to_exclude: Kbs to exclude in the patch operation. - :paramtype kb_numbers_to_exclude: list[str] - :keyword exclude_kbs_requiring_reboot: Filters out Kbs that don't have an - InstallationRebootBehavior of 'NeverReboots' when this is set to true. - :paramtype exclude_kbs_requiring_reboot: bool - :keyword max_patch_publish_date: This is used to install patches that were published on or - before this given max published date. - :paramtype max_patch_publish_date: ~datetime.datetime - :keyword patch_name_masks_to_include: This is used to include patches that match the given - patch name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :paramtype patch_name_masks_to_include: list[str] - :keyword patch_name_masks_to_exclude: This is used to exclude patches that match the given - patch name masks. Alphanumeric strings and wildcard expressions consisting of * and ? are only - supported as input values in the list. Null, empty and only whitespaces strings as inputs - values are not supported. - :paramtype patch_name_masks_to_exclude: list[str] - """ - super().__init__(**kwargs) - self.classifications_to_include = classifications_to_include - self.kb_numbers_to_include = kb_numbers_to_include - self.kb_numbers_to_exclude = kb_numbers_to_exclude - self.exclude_kbs_requiring_reboot = exclude_kbs_requiring_reboot - self.max_patch_publish_date = max_patch_publish_date - self.patch_name_masks_to_include = patch_name_masks_to_include - self.patch_name_masks_to_exclude = patch_name_masks_to_exclude diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_patch.py index f7dd32510333..ea765788358a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/models/_patch.py @@ -1,14 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py index a0baad3418e2..01f5d6d02c71 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/__init__.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. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,48 +12,47 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._licenses_operations import LicensesOperations # type: ignore -from ._machines_operations import MachinesOperations # type: ignore -from ._license_profiles_operations import LicenseProfilesOperations # type: ignore -from ._machine_extensions_operations import MachineExtensionsOperations # type: ignore -from ._hybrid_compute_management_client_operations import HybridComputeManagementClientOperationsMixin # type: ignore -from ._extension_metadata_operations import ExtensionMetadataOperations # type: ignore -from ._extension_metadata_v2_operations import ExtensionMetadataV2Operations # type: ignore -from ._extension_type_operations import ExtensionTypeOperations # type: ignore -from ._extension_publisher_operations import ExtensionPublisherOperations # type: ignore from ._operations import Operations # type: ignore -from ._network_profile_operations import NetworkProfileOperations # type: ignore -from ._machine_run_commands_operations import MachineRunCommandsOperations # type: ignore -from ._gateways_operations import GatewaysOperations # type: ignore -from ._settings_operations import SettingsOperations # type: ignore -from ._private_link_scopes_operations import PrivateLinkScopesOperations # type: ignore -from ._private_link_resources_operations import PrivateLinkResourcesOperations # type: ignore -from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations # type: ignore -from ._network_security_perimeter_configurations_operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import LicensesOperations # type: ignore +from ._operations import MachinesOperations # type: ignore +from ._operations import LicenseProfilesOperations # type: ignore +from ._operations import MachineExtensionsOperations # type: ignore +from ._operations import MachineRunCommandsOperations # type: ignore +from ._operations import GatewaysOperations # type: ignore +from ._operations import PrivateLinkResourcesOperations # type: ignore +from ._operations import PrivateEndpointConnectionsOperations # type: ignore +from ._operations import NetworkSecurityPerimeterConfigurationsOperations # type: ignore +from ._operations import NetworkProfileOperations # type: ignore +from ._operations import PrivateLinkScopesOperations # type: ignore +from ._operations import ExtensionMetadataOperations # type: ignore +from ._operations import ExtensionMetadataV2Operations # type: ignore +from ._operations import SettingsOperations # type: ignore +from ._operations import ExtensionTypeOperations # type: ignore +from ._operations import ExtensionPublisherOperations # type: ignore +from ._operations import _HybridComputeManagementClientOperationsMixin # type: ignore # pylint: disable=unused-import from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", "LicensesOperations", "MachinesOperations", "LicenseProfilesOperations", "MachineExtensionsOperations", - "HybridComputeManagementClientOperationsMixin", - "ExtensionMetadataOperations", - "ExtensionMetadataV2Operations", - "ExtensionTypeOperations", - "ExtensionPublisherOperations", - "Operations", - "NetworkProfileOperations", "MachineRunCommandsOperations", "GatewaysOperations", - "SettingsOperations", - "PrivateLinkScopesOperations", "PrivateLinkResourcesOperations", "PrivateEndpointConnectionsOperations", "NetworkSecurityPerimeterConfigurationsOperations", + "NetworkProfileOperations", + "PrivateLinkScopesOperations", + "ExtensionMetadataOperations", + "ExtensionMetadataV2Operations", + "SettingsOperations", + "ExtensionTypeOperations", + "ExtensionPublisherOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py deleted file mode 100644 index 5872695351b9..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_operations.py +++ /dev/null @@ -1,273 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - location: str, publisher: str, extension_type: str, version: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str"), - "publisher": _SERIALIZER.url("publisher", publisher, "str"), - "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), - "version": _SERIALIZER.url("version", version, "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_request( - location: str, publisher: str, extension_type: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "location": _SERIALIZER.url("location", location, "str"), - "publisher": _SERIALIZER.url("publisher", publisher, "str"), - "extensionType": _SERIALIZER.url("extension_type", extension_type, "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) - - -class ExtensionMetadataOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`extension_metadata` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any - ) -> _models.ExtensionValue: - """Gets an Extension Metadata based on location, publisher, extensionType and version. - - :param location: The location of the Extension being received. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :param version: The version of the Extension being received. Required. - :type version: str - :return: ExtensionValue or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue - :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", self._config.api_version)) - cls: ClsType[_models.ExtensionValue] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher=publisher, - extension_type=extension_type, - version=version, - 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("ExtensionValue", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, location: str, publisher: str, extension_type: str, **kwargs: Any - ) -> ItemPaged["_models.ExtensionValue"]: - """Gets all Extension versions based on location, publisher, extensionType. - - :param location: The location of the Extension being received. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :return: An iterator like instance of either ExtensionValue or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionValueListResult] = 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( - location=location, - publisher=publisher, - extension_type=extension_type, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionValueListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_v2_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_v2_operations.py deleted file mode 100644 index 4cbcd3c0b408..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_metadata_v2_operations.py +++ /dev/null @@ -1,265 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(location: str, publisher: str, extension_type: str, version: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisher": _SERIALIZER.url("publisher", publisher, "str"), - "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), - "version": _SERIALIZER.url("version", version, "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_request(location: str, publisher: str, extension_type: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisher": _SERIALIZER.url("publisher", publisher, "str"), - "extensionType": _SERIALIZER.url("extension_type", extension_type, "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) - - -class ExtensionMetadataV2Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`extension_metadata_v2` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any - ) -> _models.ExtensionValueV2: - """Gets an Extension Metadata based on location, publisher, extensionType and version. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :param version: The version of the Extension being received. Required. - :type version: str - :return: ExtensionValueV2 or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValueV2 - :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", self._config.api_version)) - cls: ClsType[_models.ExtensionValueV2] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - publisher=publisher, - extension_type=extension_type, - version=version, - 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("ExtensionValueV2", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, location: str, publisher: str, extension_type: str, **kwargs: Any - ) -> ItemPaged["_models.ExtensionValueV2"]: - """Gets all Extension versions based on location, publisher, extensionType. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :param extension_type: The extensionType of the Extension being received. Required. - :type extension_type: str - :return: An iterator like instance of either ExtensionValueV2 or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValueV2] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionValueListResultV2] = 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( - location=location, - publisher=publisher, - extension_type=extension_type, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionValueListResultV2", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_publisher_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_publisher_operations.py deleted file mode 100644 index 73dcb88f3b59..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_publisher_operations.py +++ /dev/null @@ -1,159 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.HybridCompute/locations/{location}/publishers") - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", 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) - - -class ExtensionPublisherOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`extension_publisher` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, **kwargs: Any) -> ItemPaged["_models.ExtensionPublisher"]: - """Gets all Extension publishers based on the location. - - :param location: The name of Azure region. Required. - :type location: str - :return: An iterator like instance of either ExtensionPublisher or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionPublisher] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionPublisherListResult] = 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( - location=location, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionPublisherListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_type_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_type_operations.py deleted file mode 100644 index dd038fd4540b..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_extension_type_operations.py +++ /dev/null @@ -1,165 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(location: str, publisher: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes" - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "publisher": _SERIALIZER.url("publisher", publisher, "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) - - -class ExtensionTypeOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`extension_type` 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: HybridComputeManagementClientConfiguration = ( - 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, location: str, publisher: str, **kwargs: Any) -> ItemPaged["_models.ExtensionType"]: - """Gets all Extension types based on location and publisher. - - :param location: The name of Azure region. Required. - :type location: str - :param publisher: The publisher of the Extension being received. Required. - :type publisher: str - :return: An iterator like instance of either ExtensionType or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.ExtensionTypeListResult] = 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( - location=location, - publisher=publisher, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("ExtensionTypeListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_gateways_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_gateways_operations.py deleted file mode 100644 index d8c8705c7730..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_gateways_operations.py +++ /dev/null @@ -1,895 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, gateway_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-02-19-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.HybridCompute/gateways/{gatewayName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", 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, gateway_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-02-19-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.HybridCompute/gateways/{gatewayName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", 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_get_request(resource_group_name: str, gateway_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", 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_delete_request( - resource_group_name: str, gateway_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "gatewayName": _SERIALIZER.url("gateway_name", gateway_name, "str", 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_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/gateways") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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) - - -class GatewaysOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`gateways` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _create_or_update_initial( - self, resource_group_name: str, gateway_name: str, parameters: Union[_models.Gateway, 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", self._config.api_version)) - 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, "Gateway") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - gateway_name: str, - parameters: _models.Gateway, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Gateway - :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 Gateway or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - gateway_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, gateway_name: str, parameters: Union[_models.Gateway, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.Gateway]: - """The operation to create or update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Create gateway operation. Is either a Gateway - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Gateway or IO[bytes] - :return: An instance of LROPoller that returns either Gateway or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gateway] = 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, - gateway_name=gateway_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): - deserialized = self._deserialize("Gateway", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Gateway].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Gateway]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: _models.GatewayUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - gateway_name: str, - parameters: Union[_models.GatewayUpdate, IO[bytes]], - **kwargs: Any - ) -> _models.Gateway: - """The operation to update a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :param parameters: Parameters supplied to the Update gateway operation. Is either a - GatewayUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate or IO[bytes] - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Gateway] = 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, "GatewayUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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("Gateway", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, gateway_name: str, **kwargs: Any) -> _models.Gateway: - """Retrieves information about the view of a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_name: str - :return: Gateway or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Gateway - :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", self._config.api_version)) - cls: ClsType[_models.Gateway] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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("Gateway", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial(self, resource_group_name: str, gateway_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - gateway_name=gateway_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, gateway_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete a gateway. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param gateway_name: The name of the Gateway. Required. - :type gateway_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - gateway_name=gateway_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, **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.Gateway"]: - """The operation to get all gateways of a non-Azure machine. - - :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 Gateway or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.GatewaysListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GatewaysListResult", 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_subscription(self, **kwargs: Any) -> ItemPaged["_models.Gateway"]: - """The operation to get all gateways of a non-Azure machine. - - :return: An iterator like instance of either Gateway or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Gateway] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.GatewaysListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("GatewaysListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py deleted file mode 100644 index b49edb09c594..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_hybrid_compute_management_client_operations.py +++ /dev/null @@ -1,520 +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, Dict, 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.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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Serializer -from .._utils.utils import ClientMixinABC - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_upgrade_extensions_request( - resource_group_name: str, machine_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-02-19-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.HybridCompute/machines/{machineName}/upgradeExtensions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _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_setup_extensions_request( - resource_group_name: str, machine_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-02-19-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.HybridCompute/machines/{machineName}/addExtensions", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _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 HybridComputeManagementClientOperationsMixin( # pylint: disable=name-too-long - ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], HybridComputeManagementClientConfiguration] -): - - def _upgrade_extensions_initial( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, 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", self._config.api_version)) - 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(extension_upgrade_parameters, (IOBase, bytes)): - _content = extension_upgrade_parameters - else: - _json = self._serialize.body(extension_upgrade_parameters, "MachineExtensionUpgrade") - - _request = build_upgrade_extensions_request( - resource_group_name=resource_group_name, - machine_name=machine_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: _models.MachineExtensionUpgrade, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade - :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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Required. - :type extension_upgrade_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_upgrade_extensions( - self, - resource_group_name: str, - machine_name: str, - extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """The operation to Upgrade Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. - Is either a MachineExtensionUpgrade type or a IO[bytes] type. Required. - :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade 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", self._config.api_version)) - 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._upgrade_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_upgrade_parameters=extension_upgrade_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, **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 _setup_extensions_initial( - self, - resource_group_name: str, - machine_name: str, - extensions: Union[_models.SetupExtensionRequest, 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", self._config.api_version)) - 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(extensions, (IOBase, bytes)): - _content = extensions - else: - _json = self._serialize.body(extensions, "SetupExtensionRequest") - - _request = build_setup_extensions_request( - resource_group_name=resource_group_name, - machine_name=machine_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: _models.SetupExtensionRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Required. - :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest - :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 SetupExtensionRequest or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Required. - :type extensions: 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 SetupExtensionRequest or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_setup_extensions( - self, - resource_group_name: str, - machine_name: str, - extensions: Union[_models.SetupExtensionRequest, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.SetupExtensionRequest]: - """The operation to Setup Machine Extensions. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param extensions: Parameters supplied to the Setup Extensions operation. Is either a - SetupExtensionRequest type or a IO[bytes] type. Required. - :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest or IO[bytes] - :return: An instance of LROPoller that returns either SetupExtensionRequest or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.SetupExtensionRequest] = 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._setup_extensions_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extensions=extensions, - 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("SetupExtensionRequest", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.SetupExtensionRequest].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.SetupExtensionRequest]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py deleted file mode 100644 index 792fa2ce3fbb..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_license_profiles_operations.py +++ /dev/null @@ -1,907 +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, Dict, IO, Iterator, Literal, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, machine_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-02-19-preview")) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_update_request( - resource_group_name: str, machine_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-02-19-preview")) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_get_request(resource_group_name: str, machine_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-02-19-preview")) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_delete_request( - resource_group_name: str, machine_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-02-19-preview")) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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) - - -def build_list_request(resource_group_name: str, machine_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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) - - -class LicenseProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`license_profiles` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfile, 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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, "LicenseProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - parameters: _models.LicenseProfile, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. - Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile - :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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. - 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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfile, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to create or update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Create or Update license profile operation. Is - either a LicenseProfile type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or IO[bytes] - :return: An instance of LROPoller that returns either LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LicenseProfile] = 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, - machine_name=machine_name, - parameters=parameters, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.LicenseProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LicenseProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfileUpdate, 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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, "LicenseProfileUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - parameters: _models.LicenseProfileUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate - :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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - machine_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - machine_name: str, - parameters: Union[_models.LicenseProfileUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.LicenseProfile]: - """The operation to update a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param parameters: Parameters supplied to the Update license profile operation. Is either a - LicenseProfileUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or IO[bytes] - :return: An instance of LROPoller that returns either LicenseProfile or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LicenseProfile] = 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, - machine_name=machine_name, - parameters=parameters, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.LicenseProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.LicenseProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get(self, resource_group_name: str, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: - """Retrieves information about the view of a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :return: LicenseProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile - :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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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("LicenseProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial(self, resource_group_name: str, machine_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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - license_profile_name=license_profile_name, - 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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete a license profile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_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", self._config.api_version)) - license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") - 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, - machine_name=machine_name, - api_version=api_version, - license_profile_name=license_profile_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 - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **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, machine_name: str, **kwargs: Any) -> ItemPaged["_models.LicenseProfile"]: - """The operation to get all license profiles of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine. Required. - :type machine_name: str - :return: An iterator like instance of either LicenseProfile or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicenseProfilesListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("LicenseProfilesListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py deleted file mode 100644 index 58b8f4e5ee11..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_licenses_operations.py +++ /dev/null @@ -1,1118 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_validate_license_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-02-19-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}/providers/Microsoft.HybridCompute/validateLicense" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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 - 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_create_or_update_request( - resource_group_name: str, license_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-02-19-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.HybridCompute/licenses/{licenseName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "licenseName": _SERIALIZER.url("license_name", license_name, "str", 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, license_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-02-19-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.HybridCompute/licenses/{licenseName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "licenseName": _SERIALIZER.url("license_name", license_name, "str", 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_get_request(resource_group_name: str, license_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "licenseName": _SERIALIZER.url("license_name", license_name, "str", 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_delete_request( - resource_group_name: str, license_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "licenseName": _SERIALIZER.url("license_name", license_name, "str", 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_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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) - - -class LicensesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`licenses` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _validate_license_initial( - self, parameters: Union[_models.License, 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", self._config.api_version)) - 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, "License") - - _request = build_validate_license_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) - - _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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_validate_license( - self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License - :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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_validate_license( - self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. 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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_validate_license( - self, parameters: Union[_models.License, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to validate a license. - - :param parameters: Parameters supplied to the license validation operation. Is either a License - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License or IO[bytes] - :return: An instance of LROPoller that returns either License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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._validate_license_initial( - 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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _create_or_update_initial( - self, resource_group_name: str, license_name: str, parameters: Union[_models.License, 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", self._config.api_version)) - 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, "License") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - license_name=license_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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - license_name: str, - parameters: _models.License, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License - :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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - license_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. 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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, resource_group_name: str, license_name: str, parameters: Union[_models.License, IO[bytes]], **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to create or update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Create license operation. Is either a License - type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.License or IO[bytes] - :return: An instance of LROPoller that returns either License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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, - license_name=license_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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - license_name: str, - parameters: Union[_models.LicenseUpdate, 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", self._config.api_version)) - 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, "LicenseUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - license_name=license_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]: - 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: _models.LicenseUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate - :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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. 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 License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - license_name: str, - parameters: Union[_models.LicenseUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.License]: - """The operation to update a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :param parameters: Parameters supplied to the Update license operation. Is either a - LicenseUpdate type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate or IO[bytes] - :return: An instance of LROPoller that returns either License or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.License] = 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, - license_name=license_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): - deserialized = self._deserialize("License", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.License].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.License]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get(self, resource_group_name: str, license_name: str, **kwargs: Any) -> _models.License: - """Retrieves information about the view of a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_name: str - :return: License or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.License - :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", self._config.api_version)) - cls: ClsType[_models.License] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - license_name=license_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("License", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial(self, resource_group_name: str, license_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - license_name=license_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, 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete(self, resource_group_name: str, license_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete a license. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param license_name: The name of the license. Required. - :type license_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - license_name=license_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, **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.License"]: - """The operation to get all licenses of a non-Azure machine. - - :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 License or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicensesListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("LicensesListResult", 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_subscription(self, **kwargs: Any) -> ItemPaged["_models.License"]: - """The operation to get all licenses of a non-Azure machine. - - :return: An iterator like instance of either License or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.LicensesListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("LicensesListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py deleted file mode 100644 index d96bc2add317..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_extensions_operations.py +++ /dev/null @@ -1,946 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, machine_name: str, extension_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-02-19-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.HybridCompute/machines/{machineName}/extensions/{extensionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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 - 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, machine_name: str, extension_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-02-19-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.HybridCompute/machines/{machineName}/extensions/{extensionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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 - 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, machine_name: str, extension_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, machine_name: str, extension_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "extensionName": _SERIALIZER.url("extension_name", extension_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_list_request( - resource_group_name: str, machine_name: str, subscription_id: str, *, expand: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MachineExtensionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`machine_extensions` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, 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", self._config.api_version)) - 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(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtension") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtension, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension - :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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtension, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a MachineExtension type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or IO[bytes] - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = 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, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_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("MachineExtension", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, 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", self._config.api_version)) - 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(extension_parameters, (IOBase, bytes)): - _content = extension_parameters - else: - _json = self._serialize.body(extension_parameters, "MachineExtensionUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - extension_name: str, - extension_parameters: _models.MachineExtensionUpdate, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate - :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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. - Required. - :type extension_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 MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - machine_name: str, - extension_name: str, - extension_parameters: Union[_models.MachineExtensionUpdate, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MachineExtension]: - """The operation to create or update the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be created or updated. - Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is - either a MachineExtensionUpdate type or a IO[bytes] type. Required. - :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or - IO[bytes] - :return: An instance of LROPoller that returns either MachineExtension or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineExtension] = 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, - machine_name=machine_name, - extension_name=extension_name, - extension_parameters=extension_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("MachineExtension", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.MachineExtension].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MachineExtension]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, machine_name: str, extension_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, extension_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine where the extension should be deleted. Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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, **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( - self, resource_group_name: str, machine_name: str, extension_name: str, **kwargs: Any - ) -> _models.MachineExtension: - """The operation to get the extension. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. Required. - :type machine_name: str - :param extension_name: The name of the machine extension. Required. - :type extension_name: str - :return: MachineExtension or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.MachineExtension - :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", self._config.api_version)) - cls: ClsType[_models.MachineExtension] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - extension_name=extension_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("MachineExtension", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.MachineExtension"]: - """The operation to get all extensions of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the machine containing the extension. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either MachineExtension or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.MachineExtension] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineExtensionsListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineExtensionsListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_run_commands_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_run_commands_operations.py deleted file mode 100644 index 126263efd652..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machine_run_commands_operations.py +++ /dev/null @@ -1,687 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, machine_name: str, run_command_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-02-19-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.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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 - 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, machine_name: str, run_command_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, machine_name: str, run_command_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "runCommandName": _SERIALIZER.url("run_command_name", run_command_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_list_request( - resource_group_name: str, machine_name: str, subscription_id: str, *, expand: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url("machine_name", machine_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class MachineRunCommandsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`machine_run_commands` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _create_or_update_initial( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: Union[_models.MachineRunCommand, 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", self._config.api_version)) - 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(run_command_properties, (IOBase, bytes)): - _content = run_command_properties - else: - _json = self._serialize.body(run_command_properties, "MachineRunCommand") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, - machine_name: str, - run_command_name: str, - run_command_properties: _models.MachineRunCommand, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Required. - :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand - :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 MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Required. - :type run_command_properties: 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 MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - machine_name: str, - run_command_name: str, - run_command_properties: Union[_models.MachineRunCommand, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MachineRunCommand]: - """The operation to create or update a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :param run_command_properties: Parameters supplied to the Create Run Command. Is either a - MachineRunCommand type or a IO[bytes] type. Required. - :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand or IO[bytes] - :return: An instance of LROPoller that returns either MachineRunCommand or the result of - cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineRunCommand] = 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, - machine_name=machine_name, - run_command_name=run_command_name, - run_command_properties=run_command_properties, - 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("MachineRunCommand", 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.MachineRunCommand].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MachineRunCommand]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, machine_name: str, run_command_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, run_command_name: str, **kwargs: Any - ) -> LROPoller[None]: - """The operation to delete a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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( - self, resource_group_name: str, machine_name: str, run_command_name: str, **kwargs: Any - ) -> _models.MachineRunCommand: - """The operation to get a run command. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param run_command_name: The name of the run command. Required. - :type run_command_name: str - :return: MachineRunCommand or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.MachineRunCommand - :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", self._config.api_version)) - cls: ClsType[_models.MachineRunCommand] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - run_command_name=run_command_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("MachineRunCommand", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list( - self, resource_group_name: str, machine_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.MachineRunCommand"]: - """The operation to get all the run commands of a non-Azure machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. Default value is None. - :type expand: str - :return: An iterator like instance of either MachineRunCommand or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.MachineRunCommand] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineRunCommandsListResult] = 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, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineRunCommandsListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py deleted file mode 100644 index f90813b30ddd..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_machines_operations.py +++ /dev/null @@ -1,918 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_delete_request( - resource_group_name: str, machine_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _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_request( - resource_group_name: str, - machine_name: str, - subscription_id: str, - *, - expand: Optional[Union[str, _models.InstanceViewTypes]] = 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_assess_patches_request( - resource_group_name: str, 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "name": _SERIALIZER.url("name", 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_install_patches_request( - resource_group_name: str, 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-02-19-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.HybridCompute/machines/{name}/installPatches", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "name": _SERIALIZER.url("name", 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_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, expand: 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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if expand is not None: - _params["$expand"] = _SERIALIZER.query("expand", expand, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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) - - -class MachinesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`machines` 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: HybridComputeManagementClientConfiguration = ( - 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") - - def _delete_initial(self, resource_group_name: str, machine_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - machine_name=machine_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, machine_name: str, **kwargs: Any) -> LROPoller[None]: - """The operation to delete a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - machine_name=machine_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, **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( - self, - resource_group_name: str, - machine_name: str, - expand: Optional[Union[str, _models.InstanceViewTypes]] = None, - **kwargs: Any - ) -> _models.Machine: - """Retrieves information about the model view or the instance view of a hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :param expand: The expand expression to apply on the operation. "instanceView" Default value is - None. - :type expand: str or ~azure.mgmt.hybridcompute.models.InstanceViewTypes - :return: Machine or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Machine - :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", self._config.api_version)) - cls: ClsType[_models.Machine] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_name, - subscription_id=self._config.subscription_id, - expand=expand, - 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("Machine", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _assess_patches_initial(self, resource_group_name: str, 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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_assess_patches_request( - resource_group_name=resource_group_name, - name=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")) - - 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_assess_patches( - self, resource_group_name: str, name: str, **kwargs: Any - ) -> LROPoller[_models.MachineAssessPatchesResult]: - """The operation to assess patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :return: An instance of LROPoller that returns either MachineAssessPatchesResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineAssessPatchesResult] = 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._assess_patches_initial( - resource_group_name=resource_group_name, - name=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): - deserialized = self._deserialize("MachineAssessPatchesResult", 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.MachineAssessPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MachineAssessPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _install_patches_initial( - self, - resource_group_name: str, - name: str, - install_patches_input: Union[_models.MachineInstallPatchesParameters, 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", self._config.api_version)) - 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(install_patches_input, (IOBase, bytes)): - _content = install_patches_input - else: - _json = self._serialize.body(install_patches_input, "MachineInstallPatchesParameters") - - _request = build_install_patches_request( - resource_group_name=resource_group_name, - name=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")) - - 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_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: _models.MachineInstallPatchesParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters - :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 MachineInstallPatchesResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. - Required. - :type install_patches_input: 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 MachineInstallPatchesResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_install_patches( - self, - resource_group_name: str, - name: str, - install_patches_input: Union[_models.MachineInstallPatchesParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.MachineInstallPatchesResult]: - """The operation to install patches on a hybrid machine identity in Azure. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param name: The name of the hybrid machine. Required. - :type name: str - :param install_patches_input: Input for InstallPatches as directly received by the API. Is - either a MachineInstallPatchesParameters type or a IO[bytes] type. Required. - :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters - or IO[bytes] - :return: An instance of LROPoller that returns either MachineInstallPatchesResult or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.MachineInstallPatchesResult] = 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._install_patches_initial( - resource_group_name=resource_group_name, - name=name, - install_patches_input=install_patches_input, - 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("MachineInstallPatchesResult", 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.MachineInstallPatchesResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.MachineInstallPatchesResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, expand: Optional[str] = None, **kwargs: Any - ) -> ItemPaged["_models.Machine"]: - """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the - response to get the next page of hybrid machines. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param expand: Expands referenced resources. Default value is None. - :type expand: str - :return: An iterator like instance of either Machine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Machine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineListResult] = 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, - expand=expand, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineListResult", 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_subscription(self, **kwargs: Any) -> ItemPaged["_models.Machine"]: - """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the - response to get the next page of hybrid machines. - - :return: An iterator like instance of either Machine or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Machine] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.MachineListResult] = 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_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("MachineListResult", 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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py deleted file mode 100644 index c4c2fca125e3..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_profile_operations.py +++ /dev/null @@ -1,146 +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 typing import Any, Callable, Dict, Optional, TypeVar - -from azure.core import PipelineClient -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request(resource_group_name: str, machine_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", max_length=54, min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class NetworkProfileOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`network_profile` 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: HybridComputeManagementClientConfiguration = ( - 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, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: - """The operation to get network information of hybrid machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the hybrid machine. Required. - :type machine_name: str - :return: NetworkProfile or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile - :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", self._config.api_version)) - cls: ClsType[_models.NetworkProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - machine_name=machine_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("NetworkProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_security_perimeter_configurations_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_security_perimeter_configurations_operations.py deleted file mode 100644 index 1ce90c13af4d..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_network_security_perimeter_configurations_operations.py +++ /dev/null @@ -1,449 +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 typing import Any, Callable, Dict, Iterator, Optional, TypeVar, Union, cast -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_by_private_link_scope_request( - resource_group_name: str, scope_name: str, perimeter_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations/{perimeterName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "perimeterName": _SERIALIZER.url( - "perimeter_name", - perimeter_name, - "str", - pattern=r"^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[.]{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_list_by_private_link_scope_request( - resource_group_name: str, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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_reconcile_for_private_link_scope_request( # pylint: disable=name-too-long - resource_group_name: str, scope_name: str, perimeter_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations/{perimeterName}/reconcile", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "perimeterName": _SERIALIZER.url( - "perimeter_name", - perimeter_name, - "str", - pattern=r"^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[.]{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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`network_security_perimeter_configurations` 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: HybridComputeManagementClientConfiguration = ( - 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_by_private_link_scope( - self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any - ) -> _models.NetworkSecurityPerimeterConfiguration: - """Gets the network security perimeter configuration for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the - Network Security Perimeter resource. Required. - :type perimeter_name: str - :return: NetworkSecurityPerimeterConfiguration or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration - :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", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) - - _request = build_get_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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("NetworkSecurityPerimeterConfiguration", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> ItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: - """Lists the network security perimeter configurations for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either NetworkSecurityPerimeterConfiguration or the - result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfigurationListResult] = 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_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("NetworkSecurityPerimeterConfigurationListResult", 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) - - def _reconcile_for_private_link_scope_initial( # pylint: disable=name-too-long - self, resource_group_name: str, scope_name: str, perimeter_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_reconcile_for_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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_reconcile_for_private_link_scope( - self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any - ) -> LROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]: - """Forces the network security perimeter configuration to refresh for a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the - Network Security Perimeter resource. Required. - :type perimeter_name: str - :return: An instance of LROPoller that returns either - NetworkSecurityPerimeterConfigurationReconcileResult or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationReconcileResult] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.NetworkSecurityPerimeterConfigurationReconcileResult] = 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._reconcile_for_private_link_scope_initial( - resource_group_name=resource_group_name, - scope_name=scope_name, - perimeter_name=perimeter_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): - deserialized = self._deserialize( - "NetworkSecurityPerimeterConfigurationReconcileResult", 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, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py index 39b5e09d5f3c..26d70b489211 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_operations.py @@ -1,12 +1,15 @@ +# 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, Dict, Optional, TypeVar +from io import IOBase +import json +from typing import Any, Callable, IO, Iterator, Literal, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core import PipelineClient @@ -16,35 +19,43 @@ 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 HybridComputeManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize from .._utils.serialization import Deserializer, Serializer +from .._utils.utils import ClientMixinABC T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +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 {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.HybridCompute/operations") + _url = "/providers/Microsoft.HybridCompute/operations" # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -55,6 +66,1873 @@ def build_list_request(**kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) +def build_licenses_get_request( + resource_group_name: str, license_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "licenseName": _SERIALIZER.url("license_name", license_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_licenses_create_or_update_request( + resource_group_name: str, license_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "licenseName": _SERIALIZER.url("license_name", license_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_licenses_update_request( + resource_group_name: str, license_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "licenseName": _SERIALIZER.url("license_name", license_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_licenses_delete_request( + resource_group_name: str, license_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses/{licenseName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "licenseName": _SERIALIZER.url("license_name", license_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_licenses_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/licenses" + ) + 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_licenses_list_by_subscription_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 {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/licenses" + 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_licenses_validate_license_request(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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/validateLicense" + 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_machines_get_request( + resource_group_name: str, + machine_name: str, + subscription_id: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_machines_create_or_update_request( + resource_group_name: str, machine_name: str, subscription_id: str, *, expand: Optional[str] = None, **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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "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_machines_update_request( + resource_group_name: str, machine_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_machines_delete_request( + resource_group_name: str, machine_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_machines_list_by_resource_group_request( # pylint: disable=name-too-long + resource_group_name: str, subscription_id: str, *, expand: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines" + ) + 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") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_machines_list_by_subscription_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 {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/machines" + 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_machines_assess_patches_request( + resource_group_name: str, 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/assessPatches" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", 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_machines_install_patches_request( + resource_group_name: str, 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{name}/installPatches" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "name": _SERIALIZER.url("name", 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_license_profiles_get_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_license_profiles_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_license_profiles_update_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_license_profiles_delete_request( + resource_group_name: str, machine_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles/{licenseProfileName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "licenseProfileName": _SERIALIZER.url("license_profile_name", license_profile_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_license_profiles_list_request( + resource_group_name: str, machine_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/licenseProfiles" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_machine_extensions_get_request( + resource_group_name: str, machine_name: str, extension_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_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_machine_extensions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, machine_name: str, extension_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_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_machine_extensions_update_request( + resource_group_name: str, machine_name: str, extension_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_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_machine_extensions_delete_request( + resource_group_name: str, machine_name: str, extension_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions/{extensionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "extensionName": _SERIALIZER.url("extension_name", extension_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_machine_extensions_list_request( + resource_group_name: str, machine_name: str, subscription_id: str, *, expand: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/extensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_machine_run_commands_get_request( + resource_group_name: str, machine_name: str, run_command_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_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_machine_run_commands_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, machine_name: str, run_command_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_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_machine_run_commands_delete_request( # pylint: disable=name-too-long + resource_group_name: str, machine_name: str, run_command_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands/{runCommandName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + "runCommandName": _SERIALIZER.url("run_command_name", run_command_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_machine_run_commands_list_request( + resource_group_name: str, machine_name: str, subscription_id: str, *, expand: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/runCommands" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_name, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + if expand is not None: + _params["$expand"] = _SERIALIZER.query("expand", expand, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_gateways_get_request( + resource_group_name: str, gateway_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_gateways_create_or_update_request( + resource_group_name: str, gateway_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_gateways_update_request( + resource_group_name: str, gateway_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_gateways_delete_request( + resource_group_name: str, gateway_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways/{gatewayName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "gatewayName": _SERIALIZER.url("gateway_name", gateway_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_gateways_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/gateways" + ) + 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_gateways_list_by_subscription_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 {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/gateways" + 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_private_link_resources_get_request( + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_private_link_resources_list_by_private_link_scope_request( # pylint: disable=name-too-long + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_get_request( # pylint: disable=name-too-long + resource_group_name: str, + scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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, + scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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, + scope_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_by_private_link_scope_request( # pylint: disable=name-too-long + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_network_security_perimeter_configurations_get_by_private_link_scope_request( # pylint: disable=name-too-long + resource_group_name: str, scope_name: str, perimeter_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations/{perimeterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), + "perimeterName": _SERIALIZER.url("perimeter_name", perimeter_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_network_security_perimeter_configurations_list_by_private_link_scope_request( # pylint: disable=name-too-long + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_network_security_perimeter_configurations_reconcile_for_private_link_scope_request( # pylint: disable=name-too-long + resource_group_name: str, scope_name: str, perimeter_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/networkSecurityPerimeterConfigurations/{perimeterName}/reconcile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_name, "str"), + "perimeterName": _SERIALIZER.url("perimeter_name", perimeter_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_network_profile_get_request( + resource_group_name: str, machine_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/networkProfile" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_link_scopes_get_validation_details_for_machine_request( # pylint: disable=name-too-long + resource_group_name: str, machine_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/privateLinkScopes/current" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_link_scopes_get_request( + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_link_scopes_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_link_scopes_update_tags_request( # pylint: disable=name-too-long + resource_group_name: str, scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_private_link_scopes_delete_request( + resource_group_name: str, scope_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "scopeName": _SERIALIZER.url("scope_name", scope_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_link_scopes_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes" + 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_private_link_scopes_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes" + 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_private_link_scopes_get_validation_details_request( # pylint: disable=name-too-long + location: str, private_link_scope_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "privateLinkScopeId": _SERIALIZER.url("private_link_scope_id", private_link_scope_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_extension_metadata_get_request( + location: str, publisher: str, extension_type: str, version: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), + "version": _SERIALIZER.url("version", version, "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_extension_metadata_list_request( + location: str, publisher: str, extension_type: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "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_extension_metadata_v2_get_request( + location: str, publisher: str, extension_type: str, version: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions/{version}" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "str"), + "version": _SERIALIZER.url("version", version, "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_extension_metadata_v2_list_request( + location: str, publisher: str, extension_type: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes/{extensionType}/versions" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "publisher": _SERIALIZER.url("publisher", publisher, "str"), + "extensionType": _SERIALIZER.url("extension_type", extension_type, "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_settings_get_request( + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str"), + "baseResourceType": _SERIALIZER.url("base_resource_type", base_resource_type, "str"), + "baseResourceName": _SERIALIZER.url("base_resource_name", base_resource_name, "str"), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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_settings_update_request( + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str"), + "baseResourceType": _SERIALIZER.url("base_resource_type", base_resource_type, "str"), + "baseResourceName": _SERIALIZER.url("base_resource_name", base_resource_name, "str"), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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_settings_patch_request( + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str"), + "baseResourceType": _SERIALIZER.url("base_resource_type", base_resource_type, "str"), + "baseResourceName": _SERIALIZER.url("base_resource_name", base_resource_name, "str"), + "settingsResourceName": _SERIALIZER.url("settings_resource_name", settings_resource_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_extension_type_list_request(location: str, publisher: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.HybridCompute/locations/{location}/publishers/{publisher}/extensionTypes" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "str"), + "publisher": _SERIALIZER.url("publisher", publisher, "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_extension_publisher_list_request(location: 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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/providers/Microsoft.HybridCompute/locations/{location}/publishers" + path_format_arguments = { + "location": _SERIALIZER.url("location", location, "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_hybrid_compute_management_upgrade_extensions_request( # pylint: disable=name-too-long + resource_group_name: str, machine_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-09-16-preview")) + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/upgradeExtensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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_hybrid_compute_management_setup_extensions_request( # pylint: disable=name-too-long + resource_group_name: str, machine_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-09-16-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/addExtensions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "machineName": _SERIALIZER.url("machine_name", machine_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) + + class Operations: """ .. warning:: @@ -62,10 +1940,8509 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`operations` attribute. + :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: HybridComputeManagementClientConfiguration = ( + 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.OperationValue"]: + """Gets a list of hybrid compute operations. + + :return: An iterator like instance of OperationValue + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.OperationValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationValue]] = 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), + headers=_headers, + 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.OperationValue], + 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 LicensesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`licenses` 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: HybridComputeManagementClientConfiguration = ( + 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, license_name: str, **kwargs: Any) -> _models.License: + """Retrieves information about the view of a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :return: License. The License is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.License + :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.License] = kwargs.pop("cls", None) + + _request = build_licenses_get_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.License, 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, + license_name: str, + parameters: Union[_models.License, 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_licenses_create_or_update_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + 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, + license_name: str, + parameters: _models.License, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.License, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to create or update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Create license operation. Is one of the following + types: License, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License or JSON or IO[bytes] + :return: An instance of LROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.LicenseUpdate, 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_licenses_update_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: _models.LicenseUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + license_name: str, + parameters: Union[_models.LicenseUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to update a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_name: str + :param parameters: Parameters supplied to the Update license operation. Is one of the following + types: LicenseUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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, + license_name=license_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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, license_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_licenses_delete_request( + resource_group_name=resource_group_name, + license_name=license_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) + + _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, 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 == 200: + 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 _decompress else response.iter_raw() + + 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, license_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a license. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param license_name: The name of the license. Required. + :type license_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, + license_name=license_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.License"]: + """The operation to get all licenses of a non-Azure machine. + + :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 License + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.License]] = 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_licenses_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), + headers=_headers, + 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.License], + 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_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.License"]: + """The operation to get all licenses of a non-Azure machine. + + :return: An iterator like instance of License + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.License]] = 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_licenses_list_by_subscription_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), + headers=_headers, + 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.License], + 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 _validate_license_initial( + self, parameters: Union[_models.License, 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_licenses_validate_license_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) + + _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]: + 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 = {} + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_validate_license( + self, parameters: _models.License, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License + :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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_license( + self, parameters: JSON, *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_validate_license( + self, parameters: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. 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 License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_validate_license( + self, parameters: Union[_models.License, JSON, IO[bytes]], **kwargs: Any + ) -> LROPoller[_models.License]: + """The operation to validate a license. + + :param parameters: The content of the action request. Is one of the following types: License, + JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.License or JSON or IO[bytes] + :return: An instance of LROPoller that returns License. The License is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.License] + :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.License] = 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._validate_license_initial( + 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): + 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.License, 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.License].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.License]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class MachinesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`machines` 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: HybridComputeManagementClientConfiguration = ( + 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, + machine_name: str, + *, + expand: Optional[Union[str, _models.InstanceViewTypes]] = None, + **kwargs: Any + ) -> _models.Machine: + """Retrieves information about the model view or the instance view of a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. "instanceView" Default value + is None. + :paramtype expand: str or ~azure.mgmt.hybridcompute.models.InstanceViewTypes + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = kwargs.pop("cls", None) + + _request = build_machines_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.Machine, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Machine + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: JSON + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + expand: Optional[str] = None, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Required. + :type parameters: IO[bytes] + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.Machine, JSON, IO[bytes]], + *, + expand: Optional[str] = None, + **kwargs: Any + ) -> _models.Machine: + """The operation to create or update a hybrid machine. Please note some properties can be set only + during machine creation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create hybrid machine operation. Is one of the + following types: Machine, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Machine or JSON or IO[bytes] + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = 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_machines_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.MachineUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.MachineUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. 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: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. 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: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.MachineUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Machine: + """The operation to update a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update hybrid machine operation. Is one of the + following types: MachineUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.MachineUpdate or JSON or IO[bytes] + :return: Machine. The Machine is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Machine + :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.Machine] = 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_machines_update_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Machine, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, resource_group_name: str, machine_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_machines_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, machine_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_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, + machine_name=machine_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, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.Machine"]: + """Lists all the hybrid machines in the specified resource group. Use the nextLink property in the + response to get the next page of hybrid machines. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :keyword expand: Expands referenced resources. Default value is None. + :paramtype expand: str + :return: An iterator like instance of Machine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Machine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Machine]] = 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_machines_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.Machine], + 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_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.Machine"]: + """Lists all the hybrid machines in the specified subscription. Use the nextLink property in the + response to get the next page of hybrid machines. + + :return: An iterator like instance of Machine + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Machine] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Machine]] = 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_machines_list_by_subscription_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), + headers=_headers, + 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.Machine], + 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 _assess_patches_initial(self, resource_group_name: str, 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_machines_assess_patches_request( + resource_group_name=resource_group_name, + name=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) + + _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 = _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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_assess_patches( + self, resource_group_name: str, name: str, **kwargs: Any + ) -> LROPoller[_models.MachineAssessPatchesResult]: + """The operation to assess patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :return: An instance of LROPoller that returns MachineAssessPatchesResult. The + MachineAssessPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineAssessPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.MachineAssessPatchesResult] = 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._assess_patches_initial( + resource_group_name=resource_group_name, + name=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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.MachineAssessPatchesResult, 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.MachineAssessPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MachineAssessPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _install_patches_initial( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, 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(install_patches_input, (IOBase, bytes)): + _content = install_patches_input + else: + _content = json.dumps(install_patches_input, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machines_install_patches_request( + resource_group_name=resource_group_name, + name=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) + + _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 = _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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: _models.MachineInstallPatchesParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + :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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. + Required. + :type install_patches_input: 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 MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_install_patches( + self, + resource_group_name: str, + name: str, + install_patches_input: Union[_models.MachineInstallPatchesParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MachineInstallPatchesResult]: + """The operation to install patches on a hybrid machine identity in Azure. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param name: The name of the hybrid machine. Required. + :type name: str + :param install_patches_input: Input for InstallPatches as directly received by the API. Is one + of the following types: MachineInstallPatchesParameters, JSON, IO[bytes] Required. + :type install_patches_input: ~azure.mgmt.hybridcompute.models.MachineInstallPatchesParameters + or JSON or IO[bytes] + :return: An instance of LROPoller that returns MachineInstallPatchesResult. The + MachineInstallPatchesResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineInstallPatchesResult] + :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.MachineInstallPatchesResult] = 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._install_patches_initial( + resource_group_name=resource_group_name, + name=name, + install_patches_input=install_patches_input, + 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.MachineInstallPatchesResult, 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.MachineInstallPatchesResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MachineInstallPatchesResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class LicenseProfilesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`license_profiles` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, **kwargs: Any) -> _models.LicenseProfile: + """Retrieves information about the view of a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: LicenseProfile. The LicenseProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[_models.LicenseProfile] = kwargs.pop("cls", None) + + _request = build_license_profiles_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.LicenseProfile, 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, + machine_name: str, + parameters: Union[_models.LicenseProfile, 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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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_license_profiles_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + machine_name: str, + parameters: _models.LicenseProfile, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile + :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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + 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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. + 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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfile, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to create or update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Create or Update license profile operation. Is + one of the following types: LicenseProfile, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfile or JSON or IO[bytes] + :return: An instance of LROPoller that returns LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + license_profile_name=license_profile_name, + 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.LicenseProfile, 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.LicenseProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LicenseProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, 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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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_license_profiles_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: _models.LicenseProfileUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate + :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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. 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 LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + machine_name: str, + parameters: Union[_models.LicenseProfileUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.LicenseProfile]: + """The operation to update a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param parameters: Parameters supplied to the Update license profile operation. Is one of the + following types: LicenseProfileUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.LicenseProfileUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns LicenseProfile. The LicenseProfile is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.LicenseProfile] = 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, + machine_name=machine_name, + parameters=parameters, + license_profile_name=license_profile_name, + 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.LicenseProfile, 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.LicenseProfile].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.LicenseProfile]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, machine_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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_license_profiles_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + license_profile_name=license_profile_name, + 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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, machine_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a license profile. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_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 {} + + license_profile_name: Literal["default"] = kwargs.pop("license_profile_name", "default") + 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, + machine_name=machine_name, + license_profile_name=license_profile_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, machine_name: str, **kwargs: Any) -> ItemPaged["_models.LicenseProfile"]: + """The operation to get all license profiles of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: An iterator like instance of LicenseProfile + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.LicenseProfile] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.LicenseProfile]] = 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_license_profiles_list_request( + resource_group_name=resource_group_name, + machine_name=machine_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), + headers=_headers, + 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.LicenseProfile], + 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 MachineExtensionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`machine_extensions` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, extension_name: str, **kwargs: Any + ) -> _models.MachineExtension: + """The operation to get the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :return: MachineExtension. The MachineExtension is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.MachineExtension + :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.MachineExtension] = kwargs.pop("cls", None) + + _request = build_machine_extensions_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MachineExtension, 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, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, 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(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_extensions_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _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 _decompress else response.iter_raw() + + 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, + machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtension, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension + :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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtension, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is + one of the following types: MachineExtension, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtension or JSON or + IO[bytes] + :return: An instance of LROPoller that returns MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :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.MachineExtension] = 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, + machine_name=machine_name, + extension_name=extension_name, + extension_parameters=extension_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.MachineExtension, 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.MachineExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MachineExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, 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(extension_parameters, (IOBase, bytes)): + _content = extension_parameters + else: + _content = json.dumps(extension_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_extensions_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: _models.MachineExtensionUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate + :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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. + Required. + :type extension_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 MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + machine_name: str, + extension_name: str, + extension_parameters: Union[_models.MachineExtensionUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MachineExtension]: + """The operation to create or update the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_name: str + :param extension_parameters: Parameters supplied to the Create Machine Extension operation. Is + one of the following types: MachineExtensionUpdate, JSON, IO[bytes] Required. + :type extension_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpdate or JSON or + IO[bytes] + :return: An instance of LROPoller that returns MachineExtension. The MachineExtension is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineExtension] + :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.MachineExtension] = 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, + machine_name=machine_name, + extension_name=extension_name, + extension_parameters=extension_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.MachineExtension, 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.MachineExtension].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MachineExtension]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, machine_name: str, extension_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_machine_extensions_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_name=extension_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, machine_name: str, extension_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete the extension. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_name: The name of the machine extension. Required. + :type extension_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, + machine_name=machine_name, + extension_name=extension_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, machine_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.MachineExtension"]: + """The operation to get all extensions of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of MachineExtension + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.MachineExtension] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MachineExtension]] = 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_machine_extensions_list_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.MachineExtension], + 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 MachineRunCommandsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`machine_run_commands` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, run_command_name: str, **kwargs: Any + ) -> _models.MachineRunCommand: + """The operation to get a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :return: MachineRunCommand. The MachineRunCommand is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.MachineRunCommand + :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.MachineRunCommand] = kwargs.pop("cls", None) + + _request = build_machine_run_commands_get_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.MachineRunCommand, 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, + machine_name: str, + run_command_name: str, + run_command_properties: Union[_models.MachineRunCommand, 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(run_command_properties, (IOBase, bytes)): + _content = run_command_properties + else: + _content = json.dumps(run_command_properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_machine_run_commands_create_or_update_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + machine_name: str, + run_command_name: str, + run_command_properties: _models.MachineRunCommand, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand + :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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: 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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Required. + :type run_command_properties: 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 MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + machine_name: str, + run_command_name: str, + run_command_properties: Union[_models.MachineRunCommand, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.MachineRunCommand]: + """The operation to create or update a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_name: str + :param run_command_properties: Parameters supplied to the Create Run Command. Is one of the + following types: MachineRunCommand, JSON, IO[bytes] Required. + :type run_command_properties: ~azure.mgmt.hybridcompute.models.MachineRunCommand or JSON or + IO[bytes] + :return: An instance of LROPoller that returns MachineRunCommand. The MachineRunCommand is + compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :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.MachineRunCommand] = 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, + machine_name=machine_name, + run_command_name=run_command_name, + run_command_properties=run_command_properties, + 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.MachineRunCommand, 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.MachineRunCommand].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.MachineRunCommand]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, machine_name: str, run_command_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_machine_run_commands_delete_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + run_command_name=run_command_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, machine_name: str, run_command_name: str, **kwargs: Any + ) -> LROPoller[None]: + """The operation to delete a run command. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param run_command_name: The name of the run command. Required. + :type run_command_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, + machine_name=machine_name, + run_command_name=run_command_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, machine_name: str, *, expand: Optional[str] = None, **kwargs: Any + ) -> ItemPaged["_models.MachineRunCommand"]: + """The operation to get all the run commands of a non-Azure machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :keyword expand: The expand expression to apply on the operation. Default value is None. + :paramtype expand: str + :return: An iterator like instance of MachineRunCommand + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.MachineRunCommand] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.MachineRunCommand]] = 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_machine_run_commands_list_request( + resource_group_name=resource_group_name, + machine_name=machine_name, + subscription_id=self._config.subscription_id, + expand=expand, + 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), + headers=_headers, + 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.MachineRunCommand], + 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 GatewaysOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`gateways` 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: HybridComputeManagementClientConfiguration = ( + 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, gateway_name: str, **kwargs: Any) -> _models.Gateway: + """Retrieves information about the view of a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :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.Gateway] = kwargs.pop("cls", None) + + _request = build_gateways_get_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Gateway, 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, + gateway_name: str, + parameters: Union[_models.Gateway, 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_gateways_create_or_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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 = _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["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 _decompress else response.iter_raw() + + 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, + gateway_name: str, + parameters: _models.Gateway, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Gateway + :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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. 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 Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.Gateway, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.Gateway]: + """The operation to create or update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Create gateway operation. Is one of the following + types: Gateway, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Gateway or JSON or IO[bytes] + :return: An instance of LROPoller that returns Gateway. The Gateway is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.Gateway] + :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.Gateway] = 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, + gateway_name=gateway_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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.Gateway, 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.Gateway].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.Gateway]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: _models.GatewayUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. 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: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + gateway_name: str, + parameters: Union[_models.GatewayUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Gateway: + """The operation to update a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_name: str + :param parameters: Parameters supplied to the Update gateway operation. Is one of the following + types: GatewayUpdate, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.GatewayUpdate or JSON or IO[bytes] + :return: Gateway. The Gateway is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Gateway + :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.Gateway] = 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_gateways_update_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Gateway, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, resource_group_name: str, gateway_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_gateways_delete_request( + resource_group_name=resource_group_name, + gateway_name=gateway_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + 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, gateway_name: str, **kwargs: Any) -> LROPoller[None]: + """The operation to delete a gateway. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param gateway_name: The name of the Gateway. Required. + :type gateway_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, + gateway_name=gateway_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.Gateway"]: + """The operation to get all gateways of a non-Azure machine. + + :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 Gateway + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gateway]] = 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_gateways_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), + headers=_headers, + 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.Gateway], + 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_by_subscription(self, **kwargs: Any) -> ItemPaged["_models.Gateway"]: + """The operation to get all gateways of a non-Azure machine. + + :return: An iterator like instance of Gateway + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.Gateway] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Gateway]] = 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_gateways_list_by_subscription_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), + headers=_headers, + 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.Gateway], + 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 PrivateLinkResourcesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`private_link_resources` 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: HybridComputeManagementClientConfiguration = ( + 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, scope_name: str, group_name: str, **kwargs: Any + ) -> _models.PrivateLinkResource: + """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param group_name: The name of the private link resource. Required. + :type group_name: str + :return: PrivateLinkResource. The PrivateLinkResource is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.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_private_link_resources_get_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateLinkResource"]: + """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of PrivateLinkResource + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.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_private_link_resources_list_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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 PrivateEndpointConnectionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'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: HybridComputeManagementClientConfiguration = ( + 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> _models.PrivateEndpointConnection: + """Gets a private endpoint connection. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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.hybridcompute.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, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + 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, + scope_name: str, + private_endpoint_connection_name: str, + parameters: 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(parameters, (IOBase, bytes)): + _content = parameters + else: + _content = json.dumps(parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_endpoint_connections_create_or_update_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _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 = _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 _decompress else response.iter_raw() + + 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, + scope_name: str, + private_endpoint_connection_name: str, + parameters: _models.PrivateEndpointConnection, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Required. + :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: 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 PrivateEndpointConnection. The + PrivateEndpointConnection is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + scope_name: str, + private_endpoint_connection_name: str, + parameters: Union[_models.PrivateEndpointConnection, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PrivateEndpointConnection]: + """Approve or reject a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_endpoint_connection_name: The name of the private endpoint connection. Required. + :type private_endpoint_connection_name: str + :param parameters: Is one of the following types: PrivateEndpointConnection, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.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, + scope_name=scope_name, + private_endpoint_connection_name=private_endpoint_connection_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): + 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, scope_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, + scope_name=scope_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Deletes a private endpoint connection with a given name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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, + scope_name=scope_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_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> ItemPaged["_models.PrivateEndpointConnection"]: + """Gets all private endpoint connections on a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of PrivateEndpointConnection + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.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_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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 NetworkSecurityPerimeterConfigurationsOperations: # pylint: disable=name-too-long + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`network_security_perimeter_configurations` 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: HybridComputeManagementClientConfiguration = ( + 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_by_private_link_scope( + self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any + ) -> _models.NetworkSecurityPerimeterConfiguration: + """Gets the network security perimeter configuration for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the + Network Security Perimeter resource. Required. + :type perimeter_name: str + :return: NetworkSecurityPerimeterConfiguration. The NetworkSecurityPerimeterConfiguration is + compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration + :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.NetworkSecurityPerimeterConfiguration] = kwargs.pop("cls", None) + + _request = build_network_security_perimeter_configurations_get_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfiguration, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_private_link_scope( + self, resource_group_name: str, scope_name: str, **kwargs: Any + ) -> ItemPaged["_models.NetworkSecurityPerimeterConfiguration"]: + """Lists the network security perimeter configurations for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: An iterator like instance of NetworkSecurityPerimeterConfiguration + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfiguration] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NetworkSecurityPerimeterConfiguration]] = 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_network_security_perimeter_configurations_list_by_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_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), + headers=_headers, + 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.NetworkSecurityPerimeterConfiguration], + 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 _reconcile_for_private_link_scope_initial( # pylint: disable=name-too-long + self, resource_group_name: str, scope_name: str, perimeter_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_network_security_perimeter_configurations_reconcile_for_private_link_scope_request( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_reconcile_for_private_link_scope( + self, resource_group_name: str, scope_name: str, perimeter_name: str, **kwargs: Any + ) -> LROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]: + """Forces the network security perimeter configuration to refresh for a private link scope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param perimeter_name: The name, in the format {perimeterGuid}.{associationName}, of the + Network Security Perimeter resource. Required. + :type perimeter_name: str + :return: An instance of LROPoller that returns + NetworkSecurityPerimeterConfigurationReconcileResult. The + NetworkSecurityPerimeterConfigurationReconcileResult is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.NetworkSecurityPerimeterConfigurationReconcileResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.NetworkSecurityPerimeterConfigurationReconcileResult] = 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._reconcile_for_private_link_scope_initial( + resource_group_name=resource_group_name, + scope_name=scope_name, + perimeter_name=perimeter_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): + response_headers = {} + response = pipeline_response.http_response + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.NetworkSecurityPerimeterConfigurationReconcileResult, 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.NetworkSecurityPerimeterConfigurationReconcileResult].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NetworkSecurityPerimeterConfigurationReconcileResult]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class NetworkProfileOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`network_profile` 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: HybridComputeManagementClientConfiguration = ( + 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, machine_name: str, **kwargs: Any) -> _models.NetworkProfile: + """The operation to get network information of hybrid machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: NetworkProfile. The NetworkProfile is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.NetworkProfile + :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.NetworkProfile] = kwargs.pop("cls", None) + + _request = build_network_profile_get_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.NetworkProfile, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class PrivateLinkScopesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`private_link_scopes` 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: HybridComputeManagementClientConfiguration = ( + 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_validation_details_for_machine( + self, resource_group_name: str, machine_name: str, **kwargs: Any + ) -> _models.PrivateLinkScopeValidationDetails: + """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :return: PrivateLinkScopeValidationDetails. The PrivateLinkScopeValidationDetails is compatible + with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails + :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.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_validation_details_for_machine_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkScopeValidationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> _models.HybridComputePrivateLinkScope: + """Returns a Azure Arc PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: _models.HybridComputePrivateLinkScope, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + scope_name: str, + parameters: Union[_models.HybridComputePrivateLinkScope, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value + for InstrumentationKey nor AppId in the Put operation. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param parameters: Properties that need to be specified to create or update a Azure Arc for + Servers and Clusters PrivateLinkScope. Is one of the following types: + HybridComputePrivateLinkScope, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or JSON or + IO[bytes] + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = 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_private_link_scopes_create_or_update_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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, 201]: + 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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: _models.TagsResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Required. + :type private_link_scope_tags: 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: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update_tags( + self, + resource_group_name: str, + scope_name: str, + private_link_scope_tags: Union[_models.TagsResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.HybridComputePrivateLinkScope: + """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate + method. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_name: str + :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope + instance. Is one of the following types: TagsResource, JSON, IO[bytes] Required. + :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or JSON or + IO[bytes] + :return: HybridComputePrivateLinkScope. The HybridComputePrivateLinkScope is compatible with + MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope + :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.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(private_link_scope_tags, (IOBase, bytes)): + _content = private_link_scope_tags + else: + _content = json.dumps(private_link_scope_tags, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_private_link_scopes_update_tags_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.HybridComputePrivateLinkScope, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, resource_group_name: str, scope_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_link_scopes_delete_request( + resource_group_name=resource_group_name, + scope_name=scope_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + 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 _decompress else response.iter_raw() + + 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, scope_name: str, **kwargs: Any) -> LROPoller[None]: + """Deletes a Azure Arc PrivateLinkScope. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. + :type scope_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, + scope_name=scope_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.HybridComputePrivateLinkScope"]: + """Gets a list of Azure Arc PrivateLinkScopes within a 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 HybridComputePrivateLinkScope + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridComputePrivateLinkScope]] = 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_link_scopes_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), + headers=_headers, + 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.HybridComputePrivateLinkScope], + 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.HybridComputePrivateLinkScope"]: + """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. + + :return: An iterator like instance of HybridComputePrivateLinkScope + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.HybridComputePrivateLinkScope]] = 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_link_scopes_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), + headers=_headers, + 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.HybridComputePrivateLinkScope], + 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 get_validation_details( + self, location: str, private_link_scope_id: str, **kwargs: Any + ) -> _models.PrivateLinkScopeValidationDetails: + """Returns a Azure Arc PrivateLinkScope's validation details. + + :param location: The name of the Azure region. Required. + :type location: str + :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. + Required. + :type private_link_scope_id: str + :return: PrivateLinkScopeValidationDetails. The PrivateLinkScopeValidationDetails is compatible + with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails + :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.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) + + _request = build_private_link_scopes_get_validation_details_request( + location=location, + private_link_scope_id=private_link_scope_id, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.PrivateLinkScopeValidationDetails, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExtensionMetadataOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`extension_metadata` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValue: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :return: ExtensionValue. The ExtensionValue is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValue + :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.ExtensionValue] = kwargs.pop("cls", None) + + _request = build_extension_metadata_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExtensionValue, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> ItemPaged["_models.ExtensionValue"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :return: An iterator like instance of ExtensionValue + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValue] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionValue]] = 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_extension_metadata_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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), + headers=_headers, + 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.ExtensionValue], + 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 ExtensionMetadataV2Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`extension_metadata_v2` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, extension_type: str, version: str, **kwargs: Any + ) -> _models.ExtensionValueV2: + """Gets an Extension Metadata based on location, publisher, extensionType and version. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :param version: The version of the Extension being received. Required. + :type version: str + :return: ExtensionValueV2. The ExtensionValueV2 is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.ExtensionValueV2 + :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.ExtensionValueV2] = kwargs.pop("cls", None) + + _request = build_extension_metadata_v2_get_request( + location=location, + publisher=publisher, + extension_type=extension_type, + version=version, + 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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.ExtensionValueV2, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list( + self, location: str, publisher: str, extension_type: str, **kwargs: Any + ) -> ItemPaged["_models.ExtensionValueV2"]: + """Gets all Extension versions based on location, publisher, extensionType. + + :param location: The location of the Extension being received. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :param extension_type: The extensionType of the Extension being received. Required. + :type extension_type: str + :return: An iterator like instance of ExtensionValueV2 + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionValueV2] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionValueV2]] = 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_extension_metadata_v2_list_request( + location=location, + publisher=publisher, + extension_type=extension_type, + 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), + headers=_headers, + 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.ExtensionValueV2], + 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 SettingsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`settings` 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: HybridComputeManagementClientConfiguration = ( + 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, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + **kwargs: Any + ) -> _models.Settings: + """Returns the base Settings for the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = kwargs.pop("cls", None) + + _request = build_settings_get_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: _models.Settings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: Union[_models.Settings, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Settings: + """Updates the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Is one of the following types: Settings, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings or JSON or IO[bytes] + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = 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_settings_update_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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, 201]: + 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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: _models.Settings, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. 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: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def patch( + self, + resource_group_name: str, + base_provider: str, + base_resource_type: str, + base_resource_name: str, + settings_resource_name: str, + parameters: Union[_models.Settings, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.Settings: + """Update the base Settings of the target resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param base_provider: The name of the base Resource Provider. Required. + :type base_provider: str + :param base_resource_type: The name of the base Resource Type. Required. + :type base_resource_type: str + :param base_resource_name: The name of the base resource. Required. + :type base_resource_name: str + :param settings_resource_name: The name of the settings resource. Required. + :type settings_resource_name: str + :param parameters: Settings details. Is one of the following types: Settings, JSON, IO[bytes] + Required. + :type parameters: ~azure.mgmt.hybridcompute.models.Settings or JSON or IO[bytes] + :return: Settings. The Settings is compatible with MutableMapping + :rtype: ~azure.mgmt.hybridcompute.models.Settings + :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.Settings] = 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_settings_patch_request( + resource_group_name=resource_group_name, + base_provider=base_provider, + base_resource_type=base_resource_type, + base_resource_name=base_resource_name, + settings_resource_name=settings_resource_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) + + _decompress = kwargs.pop("decompress", True) + _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() if _decompress else response.iter_raw() + else: + deserialized = _deserialize(_models.Settings, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ExtensionTypeOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`extension_type` 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: HybridComputeManagementClientConfiguration = ( + 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, location: str, publisher: str, **kwargs: Any) -> ItemPaged["_models.ExtensionType"]: + """Gets all Extension types based on location and publisher. + + :param location: The location name. Required. + :type location: str + :param publisher: The publisher of the Extension being received. Required. + :type publisher: str + :return: An iterator like instance of ExtensionType + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ExtensionType]] = 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_extension_type_list_request( + location=location, + publisher=publisher, + 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), + headers=_headers, + 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.ExtensionType], + 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 ExtensionPublisherOperations: """ + .. warning:: + **DO NOT** instantiate this class directly. - models = _models + Instead, you should access the following operations through + :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s + :attr:`extension_publisher` attribute. + """ def __init__(self, *args, **kwargs) -> None: input_args = list(args) @@ -77,18 +10454,19 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list(self, **kwargs: Any) -> ItemPaged["_models.OperationValue"]: - """Gets a list of hybrid compute operations. + def list(self, location: str, **kwargs: Any) -> ItemPaged["_models.ExtensionPublisher"]: + """Gets all Extension publishers based on the location. - :return: An iterator like instance of either OperationValue or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.OperationValue] + :param location: The location name. Required. + :type location: str + :return: An iterator like instance of ExtensionPublisher + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.ExtensionPublisher] :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", self._config.api_version)) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) + cls: ClsType[List[_models.ExtensionPublisher]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -101,12 +10479,18 @@ def list(self, **kwargs: Any) -> ItemPaged["_models.OperationValue"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_extension_publisher_list_request( + location=location, + 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: # make call to next link with the client's api-version @@ -119,18 +10503,29 @@ def prepare_request(next_link=None): ) _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 + "GET", + urllib.parse.urljoin(next_link, _parsed_next_link.path), + headers=_headers, + params=_next_request_params, ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" + 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.ExtensionPublisher], + deserialized.get("value", []), + ) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return 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) @@ -143,9 +10538,493 @@ 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(_models.ErrorResponse, pipeline_response) + 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 _HybridComputeManagementClientOperationsMixin( + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], HybridComputeManagementClientConfiguration] +): + + def _upgrade_extensions_initial( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, 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(extension_upgrade_parameters, (IOBase, bytes)): + _content = extension_upgrade_parameters + else: + _content = json.dumps(extension_upgrade_parameters, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_compute_management_upgrade_extensions_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: _models.MachineExtensionUpgrade, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade + :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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Required. + :type extension_upgrade_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_upgrade_extensions( + self, + resource_group_name: str, + machine_name: str, + extension_upgrade_parameters: Union[_models.MachineExtensionUpgrade, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """The operation to Upgrade Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extension_upgrade_parameters: Parameters supplied to the Upgrade Extensions operation. + Is one of the following types: MachineExtensionUpgrade, JSON, IO[bytes] Required. + :type extension_upgrade_parameters: ~azure.mgmt.hybridcompute.models.MachineExtensionUpgrade 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._upgrade_extensions_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + extension_upgrade_parameters=extension_upgrade_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 + + def _setup_extensions_initial( + self, + resource_group_name: str, + machine_name: str, + extensions: Union[_models.SetupExtensionRequest, 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(extensions, (IOBase, bytes)): + _content = extensions + else: + _content = json.dumps(extensions, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_hybrid_compute_management_setup_extensions_request( + resource_group_name=resource_group_name, + machine_name=machine_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) + + _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 = _failsafe_deserialize( + _models.ErrorResponse, + response, + ) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 202: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = response.iter_bytes() if _decompress else response.iter_raw() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: _models.SetupExtensionRequest, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest + :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 SetupExtensionRequest. The SetupExtensionRequest + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: 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 SetupExtensionRequest. The SetupExtensionRequest + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Required. + :type extensions: 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 SetupExtensionRequest. The SetupExtensionRequest + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_setup_extensions( + self, + resource_group_name: str, + machine_name: str, + extensions: Union[_models.SetupExtensionRequest, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.SetupExtensionRequest]: + """The operation to Setup Machine Extensions. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param machine_name: The name of the hybrid machine. Required. + :type machine_name: str + :param extensions: Parameters supplied to the Setup Extensions operation. Is one of the + following types: SetupExtensionRequest, JSON, IO[bytes] Required. + :type extensions: ~azure.mgmt.hybridcompute.models.SetupExtensionRequest or JSON or IO[bytes] + :return: An instance of LROPoller that returns SetupExtensionRequest. The SetupExtensionRequest + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.SetupExtensionRequest] + :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.SetupExtensionRequest] = 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._setup_extensions_initial( + resource_group_name=resource_group_name, + machine_name=machine_name, + extensions=extensions, + 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["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + + deserialized = _deserialize(_models.SetupExtensionRequest, 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.SetupExtensionRequest].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.SetupExtensionRequest]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_patch.py index f7dd32510333..ea765788358a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_patch.py @@ -1,14 +1,14 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ -from typing import List -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level +__all__: list[str] = [] # Add all objects you want publicly available to users at this package level def patch_sdk(): diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py deleted file mode 100644 index 433afef35119..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_endpoint_connections_operations.py +++ /dev/null @@ -1,692 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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, - scope_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-02-19-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.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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, - scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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) - - -def build_list_by_private_link_scope_request( - resource_group_name: str, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateEndpointConnections", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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) - - -class PrivateEndpointConnectionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'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: HybridComputeManagementClientConfiguration = ( - 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> _models.PrivateEndpointConnection: - """Gets a private endpoint connection. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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.hybridcompute.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", self._config.api_version)) - cls: ClsType[_models.PrivateEndpointConnection] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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, - scope_name: str, - private_endpoint_connection_name: str, - parameters: 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", self._config.api_version)) - 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, "PrivateEndpointConnection") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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, 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) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: _models.PrivateEndpointConnection, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Required. - :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: 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 PrivateEndpointConnection or the result - of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.hybridcompute.models.PrivateEndpointConnection] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - scope_name: str, - private_endpoint_connection_name: str, - parameters: Union[_models.PrivateEndpointConnection, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.PrivateEndpointConnection]: - """Approve or reject a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_endpoint_connection_name: The name of the private endpoint connection. Required. - :type private_endpoint_connection_name: str - :param parameters: Is either a PrivateEndpointConnection type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.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.hybridcompute.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", self._config.api_version)) - 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, - scope_name=scope_name, - private_endpoint_connection_name=private_endpoint_connection_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): - 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, **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, scope_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, scope_name: str, private_endpoint_connection_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a private endpoint connection with a given name. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_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, **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_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateEndpointConnection"]: - """Gets all private endpoint connections on a private link scope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateEndpointConnection or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.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", self._config.api_version)) - 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_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.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) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py deleted file mode 100644 index 897e9731a3e6..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_resources_operations.py +++ /dev/null @@ -1,271 +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 typing import Any, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_private_link_scope_request( - resource_group_name: str, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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) - - -class PrivateLinkResourcesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`private_link_resources` 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: HybridComputeManagementClientConfiguration = ( - 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_by_private_link_scope( - self, resource_group_name: str, scope_name: str, **kwargs: Any - ) -> ItemPaged["_models.PrivateLinkResource"]: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: An iterator like instance of either PrivateLinkResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.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", self._config.api_version)) - 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_by_private_link_scope_request( - resource_group_name=resource_group_name, - scope_name=scope_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.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( - self, resource_group_name: str, scope_name: str, group_name: str, **kwargs: Any - ) -> _models.PrivateLinkResource: - """Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param group_name: The name of the private link resource. Required. - :type group_name: str - :return: PrivateLinkResource or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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 diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py deleted file mode 100644 index 4d6d330f2a98..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_private_link_scopes_operations.py +++ /dev/null @@ -1,1036 +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, Dict, IO, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/privateLinkScopes" - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", 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_delete_request(resource_group_name: str, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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_request(resource_group_name: str, scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/privateLinkScopes/{scopeName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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_or_update_request( - resource_group_name: str, scope_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-02-19-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.HybridCompute/privateLinkScopes/{scopeName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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_tags_request( - resource_group_name: str, scope_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-02-19-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.HybridCompute/privateLinkScopes/{scopeName}", - ) - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "scopeName": _SERIALIZER.url("scope_name", scope_name, "str", 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_get_validation_details_request( - location: str, private_link_scope_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.HybridCompute/locations/{location}/privateLinkScopes/{privateLinkScopeId}", - ) - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str", min_length=1), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "privateLinkScopeId": _SERIALIZER.url("private_link_scope_id", private_link_scope_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_get_validation_details_for_machine_request( # pylint: disable=name-too-long - resource_group_name: str, machine_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-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/privateLinkScopes/current", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "machineName": _SERIALIZER.url( - "machine_name", machine_name, "str", min_length=1, pattern=r"^[a-zA-Z0-9-_\.]{1,54}$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class PrivateLinkScopesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`private_link_scopes` 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: HybridComputeManagementClientConfiguration = ( - 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.HybridComputePrivateLinkScope"]: - """Gets a list of all Azure Arc PrivateLinkScopes within a subscription. - - :return: An iterator like instance of either HybridComputePrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("HybridComputePrivateLinkScopeListResult", 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.HybridComputePrivateLinkScope"]: - """Gets a list of Azure Arc PrivateLinkScopes within a 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 HybridComputePrivateLinkScope or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScopeListResult] = 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: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._config.api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("HybridComputePrivateLinkScopeListResult", 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) - - def _delete_initial(self, resource_group_name: str, scope_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", self._config.api_version)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - scope_name=scope_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")) - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - - 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, scope_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_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", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - scope_name=scope_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, **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(self, resource_group_name: str, scope_name: str, **kwargs: Any) -> _models.HybridComputePrivateLinkScope: - """Returns a Azure Arc PrivateLinkScope. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: _models.HybridComputePrivateLinkScope, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. 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: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - scope_name: str, - parameters: Union[_models.HybridComputePrivateLinkScope, IO[bytes]], - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Creates (or updates) a Azure Arc PrivateLinkScope. Note: You cannot specify a different value - for InstrumentationKey nor AppId in the Put operation. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param parameters: Properties that need to be specified to create or update a Azure Arc for - Servers and Clusters PrivateLinkScope. Is either a HybridComputePrivateLinkScope type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope or IO[bytes] - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = 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, "HybridComputePrivateLinkScope") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: _models.TagsResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Required. - :type private_link_scope_tags: 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: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update_tags( - self, - resource_group_name: str, - scope_name: str, - private_link_scope_tags: Union[_models.TagsResource, IO[bytes]], - **kwargs: Any - ) -> _models.HybridComputePrivateLinkScope: - """Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate - method. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param scope_name: The name of the Azure Arc PrivateLinkScope resource. Required. - :type scope_name: str - :param private_link_scope_tags: Updated tag information to set into the PrivateLinkScope - instance. Is either a TagsResource type or a IO[bytes] type. Required. - :type private_link_scope_tags: ~azure.mgmt.hybridcompute.models.TagsResource or IO[bytes] - :return: HybridComputePrivateLinkScope or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.HybridComputePrivateLinkScope - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.HybridComputePrivateLinkScope] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(private_link_scope_tags, (IOBase, bytes)): - _content = private_link_scope_tags - else: - _json = self._serialize.body(private_link_scope_tags, "TagsResource") - - _request = build_update_tags_request( - resource_group_name=resource_group_name, - scope_name=scope_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("HybridComputePrivateLinkScope", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_validation_details( - self, location: str, private_link_scope_id: str, **kwargs: Any - ) -> _models.PrivateLinkScopeValidationDetails: - """Returns a Azure Arc PrivateLinkScope's validation details. - - :param location: The location of the target resource. Required. - :type location: str - :param private_link_scope_id: The id (Guid) of the Azure Arc PrivateLinkScope resource. - Required. - :type private_link_scope_id: str - :return: PrivateLinkScopeValidationDetails or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails - :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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) - - _request = build_get_validation_details_request( - location=location, - private_link_scope_id=private_link_scope_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("PrivateLinkScopeValidationDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_validation_details_for_machine( - self, resource_group_name: str, machine_name: str, **kwargs: Any - ) -> _models.PrivateLinkScopeValidationDetails: - """Returns a Azure Arc PrivateLinkScope's validation details for a given machine. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param machine_name: The name of the target machine to get the private link scope validation - details for. Required. - :type machine_name: str - :return: PrivateLinkScopeValidationDetails or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.PrivateLinkScopeValidationDetails - :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", self._config.api_version)) - cls: ClsType[_models.PrivateLinkScopeValidationDetails] = kwargs.pop("cls", None) - - _request = build_get_validation_details_for_machine_request( - resource_group_name=resource_group_name, - machine_name=machine_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("PrivateLinkScopeValidationDetails", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_settings_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_settings_operations.py deleted file mode 100644 index 52582511c325..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/azure/mgmt/hybridcompute/operations/_settings_operations.py +++ /dev/null @@ -1,601 +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, Dict, 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.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 HybridComputeManagementClientConfiguration -from .._utils.serialization import Deserializer, Serializer - -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_get_request( - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "baseResourceType": _SERIALIZER.url( - "base_resource_type", base_resource_type, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "baseResourceName": _SERIALIZER.url( - "base_resource_name", base_resource_name, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "settingsResourceName": _SERIALIZER.url( - "settings_resource_name", settings_resource_name, "str", pattern=r"default" - ), - } - - _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, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-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/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "baseResourceType": _SERIALIZER.url( - "base_resource_type", base_resource_type, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "baseResourceName": _SERIALIZER.url( - "base_resource_name", base_resource_name, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "settingsResourceName": _SERIALIZER.url( - "settings_resource_name", settings_resource_name, "str", pattern=r"default" - ), - } - - _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_patch_request( - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - subscription_id: str, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-02-19-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/{baseProvider}/{baseResourceType}/{baseResourceName}/providers/Microsoft.HybridCompute/settings/{settingsResourceName}", - ) - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "baseProvider": _SERIALIZER.url("base_provider", base_provider, "str", pattern=r"[a-zA-Z0-9-_\.]+"), - "baseResourceType": _SERIALIZER.url( - "base_resource_type", base_resource_type, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "baseResourceName": _SERIALIZER.url( - "base_resource_name", base_resource_name, "str", pattern=r"[a-zA-Z0-9-_\.]+" - ), - "settingsResourceName": _SERIALIZER.url( - "settings_resource_name", settings_resource_name, "str", pattern=r"default" - ), - } - - _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) - - -class SettingsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.hybridcompute.HybridComputeManagementClient`'s - :attr:`settings` 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: HybridComputeManagementClientConfiguration = ( - 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, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - **kwargs: Any - ) -> _models.Settings: - """Returns the base Settings for the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - cls: ClsType[_models.Settings] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", 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, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: _models.Settings, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. 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: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: Union[_models.Settings, IO[bytes]], - **kwargs: Any - ) -> _models.Settings: - """Updates the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Is either a Settings type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings or IO[bytes] - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Settings] = 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, "Settings") - - _request = build_update_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: _models.Settings, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. 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: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def patch( - self, - resource_group_name: str, - base_provider: str, - base_resource_type: str, - base_resource_name: str, - settings_resource_name: str, - parameters: Union[_models.Settings, IO[bytes]], - **kwargs: Any - ) -> _models.Settings: - """Update the base Settings of the target resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param base_provider: The name of the base Resource Provider. Required. - :type base_provider: str - :param base_resource_type: The name of the base Resource Type. Required. - :type base_resource_type: str - :param base_resource_name: The name of the base resource. Required. - :type base_resource_name: str - :param settings_resource_name: The name of the settings resource. Required. - :type settings_resource_name: str - :param parameters: Settings details. Is either a Settings type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.hybridcompute.models.Settings or IO[bytes] - :return: Settings or the result of cls(response) - :rtype: ~azure.mgmt.hybridcompute.models.Settings - :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", self._config.api_version)) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Settings] = 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, "Settings") - - _request = build_patch_request( - resource_group_name=resource_group_name, - base_provider=base_provider, - base_resource_type=base_resource_type, - base_resource_name=base_resource_name, - settings_resource_name=settings_resource_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("Settings", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_add.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_add.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_add.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_add.py index a032f4904fb3..839af731b7e2 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_add.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_add.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.begin_setup_extensions( @@ -44,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_Add.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_Add.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_create_or_update.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_create_or_update.py index 8855f44eaab9..9f20689d59e2 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_create_or_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_create_or_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_extensions.begin_create_or_update( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_CreateOrUpdate.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_delete.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_delete.py index 8c389b39bf6f..395986cb0bb7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.machine_extensions.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_Delete.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_get.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_get.py index c02e61ecfa90..4d19ac6b72a1 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_extensions.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_Get.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_list.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_list.py index 071297de0601..1c460faff2eb 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_extensions.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_List.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_get.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_get.py index 77a6e7aca715..1298a25ceeeb 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="SUBSCRIPTION_ID", ) response = client.extension_metadata.get( @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionMetadata_Get.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionMetadata_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_list.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_list.py index ed9ab19c5dd8..bfa5fa29c433 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", + subscription_id="SUBSCRIPTION_ID", ) response = client.extension_metadata.list( @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionMetadata_List.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionMetadata_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_get.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_get.py index a75e69dd677b..0d1af43c556a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_get.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. # -------------------------------------------------------------------------- @@ -40,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionMetadataV2_Get.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionMetadataV2_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_list.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_list.py index ef87c8513803..5b9e74f44f85 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_metadata_v2_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_metadata_v2_list.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. # -------------------------------------------------------------------------- @@ -40,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionMetadataV2_List.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionMetadataV2_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_publisher_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_publisher_list.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_publisher_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_publisher_list.py index e46dea877461..69c1176203e8 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_publisher_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_publisher_list.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. # -------------------------------------------------------------------------- @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionPublisher_List.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionPublisher_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_type_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_type_list.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_type_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_type_list.py index 57a5ff8173ee..bdfb664fad72 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_type_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_type_list.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. # -------------------------------------------------------------------------- @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/ExtensionType_List.json +# x-ms-original-file: 2025-09-16-preview/extension/ExtensionType_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_update.py similarity index 85% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_update.py index cffd809853e5..3d9c9dc71323 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extension_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_extensions.begin_update( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extension_Update.json +# x-ms-original-file: 2025-09-16-preview/extension/Extension_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.py similarity index 83% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.py index 372c49a08699..108ce8f6da6a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extension/extensions_upgrade.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/extensions_upgrade.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.begin_upgrade_extensions( @@ -43,6 +42,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/extension/Extensions_Upgrade.json +# x-ms-original-file: 2025-09-16-preview/extension/Extensions_Upgrade.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_create_or_update.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_create_or_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_create_or_update.py index 9c74db634891..149b68e277a5 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_create_or_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_create_or_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) response = client.gateways.begin_create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_CreateOrUpdate.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_delete.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_delete.py index 77e2665798dd..ff7012925901 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) client.gateways.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_Delete.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_get.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_get.py index 132ef7869bc9..cdda19869ce8 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) response = client.gateways.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_Get.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_resource_group.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_resource_group.py index ab758f7589dd..d91961f82d7c 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_resource_group.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) response = client.gateways.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_ListByResourceGroup.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_subscription.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_subscription.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_subscription.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_subscription.py index 8958609c70d4..e8c955a70c88 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_list_by_subscription.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_list_by_subscription.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) response = client.gateways.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_ListBySubscription.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_update.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_update.py index 85e51ac39976..5ca137a3de19 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway/gateway_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/gateway_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="ffd506c8-3415-42d3-9612-fdb423fb17df", + subscription_id="SUBSCRIPTION_ID", ) response = client.gateways.update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/gateway/Gateway_Update.json +# x-ms-original-file: 2025-09-16-preview/gateway/Gateway_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_create_or_update.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_create_or_update.py index 14521c8a74c1..86d67f5a698f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_create_or_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_create_or_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.begin_create_or_update( @@ -51,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_CreateOrUpdate.json +# x-ms-original-file: 2025-09-16-preview/license/License_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_delete.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_delete.py index 1f6795cb6c9e..020aac1c2c1b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.licenses.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_Delete.json +# x-ms-original-file: 2025-09-16-preview/license/License_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_get.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_get.py index 9b4efedbf1e3..6bccf6b081cf 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_Get.json +# x-ms-original-file: 2025-09-16-preview/license/License_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_resource_group.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_resource_group.py index b47836721e22..49afbc37c3ee 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_resource_group.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_ListByResourceGroup.json +# x-ms-original-file: 2025-09-16-preview/license/License_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_subscription.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_subscription.py index a188ce9946fe..5aad6c4aec8e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_list_by_subscription.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_list_by_subscription.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_ListBySubscription.json +# x-ms-original-file: 2025-09-16-preview/license/License_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_create_or_update.py similarity index 85% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_create_or_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_create_or_update.py index 4824e8037ad9..6b6c25273f51 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_create_or_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_create_or_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.license_profiles.begin_create_or_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/licenseProfile/LicenseProfile_CreateOrUpdate.json +# x-ms-original-file: 2025-09-16-preview/licenseProfile/LicenseProfile_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_delete.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_delete.py index 6e4315667523..a0dfda433e23 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.license_profiles.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/licenseProfile/LicenseProfile_Delete.json +# x-ms-original-file: 2025-09-16-preview/licenseProfile/LicenseProfile_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_get.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_get.py index 9bf170e1277a..5b5f91c92521 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.license_profiles.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/licenseProfile/LicenseProfile_Get.json +# x-ms-original-file: 2025-09-16-preview/licenseProfile/LicenseProfile_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_list.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_list.py index 05e61fb2dc5d..356e520cae05 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.license_profiles.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/licenseProfile/LicenseProfile_List.json +# x-ms-original-file: 2025-09-16-preview/licenseProfile/LicenseProfile_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_update.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_update.py index 6ba85b36c5d8..06ca8fd3a758 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile/license_profile_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_profile_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.license_profiles.begin_update( @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/licenseProfile/LicenseProfile_Update.json +# x-ms-original-file: 2025-09-16-preview/licenseProfile/LicenseProfile_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_update.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_update.py index a24acde08511..62e3566bcbe6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.begin_update( @@ -50,6 +49,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_Update.json +# x-ms-original-file: 2025-09-16-preview/license/License_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_validate_license.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_validate_license.py index 16fef749a5a1..8c3717578b38 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license/license_validate_license.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/license_validate_license.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.licenses.begin_validate_license( @@ -49,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/license/License_ValidateLicense.json +# x-ms-original-file: 2025-09-16-preview/license/License_ValidateLicense.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_assess_patches.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_assess_patches.py index c3a3b4108f78..ec2f055738f9 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_assess_patches.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_assess_patches.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.begin_assess_patches( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machine_AssessPatches.json +# x-ms-original-file: 2025-09-16-preview/machine/Machine_AssessPatches.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_install_patches.py similarity index 84% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_install_patches.py index f6f07aad3f36..2834879cad10 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machine_install_patches.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine_install_patches.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.begin_install_patches( @@ -48,6 +47,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machine_InstallPatches.json +# x-ms-original-file: 2025-09-16-preview/machine/Machine_InstallPatches.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_create_or_update.py new file mode 100644 index 000000000000..e58b5fd0ae9d --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_create_or_update.py @@ -0,0 +1,57 @@ +# 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) 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python machines_create_or_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.machines.create_or_update( + resource_group_name="myResourceGroup", + machine_name="myMachine", + parameters={ + "identity": {"type": "SystemAssigned"}, + "location": "eastus2euap", + "properties": { + "clientPublicKey": "string", + "identityKeyStore": "TPM", + "locationData": {"name": "Redmond"}, + "osProfile": {"windowsConfiguration": {"patchSettings": {"enableHotpatching": True}}}, + "parentClusterResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.AzureStackHCI/clusters/myAzureStackHCICluster", + "privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName", + "tpmEkCertificate": "string", + "vmId": "b7a098cc-b0b8-46e8-a205-62f301a62a8f", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-09-16-preview/machine/Machines_CreateOrUpdate.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.py index bdb4ad2dc483..dbf47aa8fbe6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.machines.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machines_Delete.json +# x-ms-original-file: 2025-09-16-preview/machine/Machines_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.py index 4214186cb9f6..df4ba60d075e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machines_Get.json +# x-ms-original-file: 2025-09-16-preview/machine/Machines_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get_license_profile_instance_view.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get_license_profile_instance_view.py index ca705c8588ec..eafae15a8ea7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_get_license_profile_instance_view.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_get_license_profile_instance_view.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machines_Get_LicenseProfileInstanceView.json +# x-ms-original-file: 2025-09-16-preview/machine/Machines_Get_LicenseProfileInstanceView.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.py index bd8b6dcfe013..5280a02407dc 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_resource_group.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machines_ListByResourceGroup.json +# x-ms-original-file: 2025-09-16-preview/machine/Machines_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.py index e50610c83dcb..e975de9628a0 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machine/machines_list_by_subscription.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_list_by_subscription.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscription-id}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machines.list_by_subscription() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/machine/Machines_ListBySubscription.json +# x-ms-original-file: 2025-09-16-preview/machine/Machines_ListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_update.py new file mode 100644 index 000000000000..90fe25925203 --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/machines_update.py @@ -0,0 +1,63 @@ +# 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) 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.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python machines_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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.machines.update( + resource_group_name="myResourceGroup", + machine_name="myMachine", + parameters={ + "identity": {"type": "SystemAssigned"}, + "properties": { + "identityKeyStore": "TPM", + "locationData": {"name": "Redmond"}, + "osProfile": { + "linuxConfiguration": {"patchSettings": {"assessmentMode": "ImageDefault", "patchMode": "Manual"}}, + "windowsConfiguration": { + "patchSettings": { + "assessmentMode": "ImageDefault", + "enableHotpatching": True, + "patchMode": "AutomaticByPlatform", + } + }, + }, + "parentClusterResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.AzureStackHCI/clusters/myAzureStackHCICluster", + "privateLinkScopeResourceId": "/subscriptions/{subscriptionId}/resourceGroups/myResourceGroup/providers/Microsoft.HybridCompute/privateLinkScopes/privateLinkScopeName", + "tpmEkCertificate": "string", + }, + }, + ) + print(response) + + +# x-ms-original-file: 2025-09-16-preview/machine/Machines_Update.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.py index 60ca5f38b1ac..1810e77b349a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_profile_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_profile.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/NetworkProfile_Get.json +# x-ms-original-file: 2025-09-16-preview/NetworkProfile_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_get.py similarity index 82% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_get.py index ba47a593c29b..5910aaa31473 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_get.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_security_perimeter_configurations.get_by_private_link_scope( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationGet.json +# x-ms-original-file: 2025-09-16-preview/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_list.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_list.py index 740790a1e6d6..5f3f71a79d0f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_list.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_security_perimeter_configurations.list_by_private_link_scope( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationList.json +# x-ms-original-file: 2025-09-16-preview/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationList.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_reconcile.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_reconcile.py similarity index 82% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_reconcile.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_reconcile.py index 4184d6a3c96b..9946273e3e1f 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration/network_security_perimeter_configuration_reconcile.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/network_security_perimeter_configuration_reconcile.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.network_security_perimeter_configurations.begin_reconcile_for_private_link_scope( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationReconcile.json +# x-ms-original-file: 2025-09-16-preview/networkSecurityPerimeterConfiguration/NetworkSecurityPerimeterConfigurationReconcile.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py index a03a727871cc..bc410c8c238a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/operations_list.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. # -------------------------------------------------------------------------- @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/Operations_List.json +# x-ms-original-file: 2025-09-16-preview/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.py index 5e2be867ed15..df0d49fc1d2e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) client.private_endpoint_connections.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateEndpoint/PrivateEndpointConnection_Delete.json +# x-ms-original-file: 2025-09-16-preview/privateEndpoint/PrivateEndpointConnection_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.py index f14a392af4c5..af7716ebd221 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateEndpoint/PrivateEndpointConnection_Get.json +# x-ms-original-file: 2025-09-16-preview/privateEndpoint/PrivateEndpointConnection_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.py index 65f8e5c98a52..1518b841f752 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.list_by_private_link_scope( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateEndpoint/PrivateEndpointConnection_List.json +# x-ms-original-file: 2025-09-16-preview/privateEndpoint/PrivateEndpointConnection_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.py index 2975b6f52958..26df339186e6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint/private_endpoint_connection_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_endpoint_connection_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_endpoint_connections.begin_create_or_update( @@ -38,7 +37,7 @@ def main(): parameters={ "properties": { "privateLinkServiceConnectionState": { - "description": "Approved by johndoe@contoso.com", + "description": "Approved by `johndoe@contoso.com `_", "status": "Approved", } } @@ -47,6 +46,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateEndpoint/PrivateEndpointConnection_Update.json +# x-ms-original-file: 2025-09-16-preview/privateEndpoint/PrivateEndpointConnection_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.py index f27d550bd643..6229b3595a46 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopePrivateLinkResource_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.py index 4e7bd1cc4baa..06c23291d4b7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scope_private_link_resource_list_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope_private_link_resource_list_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_resources.list_by_private_link_scope( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopePrivateLinkResource_ListGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.py index d86c6959a2b5..38a7ee7c3e98 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_create.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_create.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_Create.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_Create.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.py index 82b83bffc6f7..140ca040acbd 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) client.private_link_scopes.begin_delete( @@ -37,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_Delete.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.py index 1e690798daff..bddafc719e68 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.get( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_Get.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.py index 41a67b60641d..2df127eca648 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.get_validation_details( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidation.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_GetValidation.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.py index 96fa5845b10f..4963b9608d93 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_get_validation_for_machine.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_get_validation_for_machine.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.get_validation_details_for_machine( @@ -38,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_GetValidationForMachine.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.py similarity index 78% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.py index bab333c15eef..c2b451514009 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.list() @@ -36,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_List.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.py similarity index 79% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.py index 5478fbea26ac..770756be0457 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_list_by_resource_group.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_list_by_resource_group.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.list_by_resource_group( @@ -38,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.py similarity index 80% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.py index 8146ae8388f0..f78a6bfa31e3 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scope/private_link_scopes_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) response = client.private_link_scopes.create_or_update( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/privateLinkScope/PrivateLinkScopes_Update.json +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_Update.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update_tags_only.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update_tags_only.py new file mode 100644 index 000000000000..aac23bd9906e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/private_link_scopes_update_tags_only.py @@ -0,0 +1,43 @@ +# 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. +# -------------------------------------------------------------------------- + +from azure.identity import DefaultAzureCredential + +from azure.mgmt.hybridcompute import HybridComputeManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-hybridcompute +# USAGE + python private_link_scopes_update_tags_only.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 = HybridComputeManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + response = client.private_link_scopes.update_tags( + resource_group_name="my-resource-group", + scope_name="my-privatelinkscope", + private_link_scope_tags={"tags": {"Tag1": "Value1", "Tag2": "Value2"}}, + ) + print(response) + + +# x-ms-original-file: 2025-09-16-preview/privateLinkScope/PrivateLinkScopes_UpdateTagsOnly.json +if __name__ == "__main__": + main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_create_or_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_create_or_update.py similarity index 88% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_create_or_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_create_or_update.py index 7c32c7131035..7af6cb5b2670 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_create_or_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_create_or_update.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_run_commands.begin_create_or_update( @@ -52,6 +52,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/runCommand/RunCommands_CreateOrUpdate.json +# x-ms-original-file: 2025-09-16-preview/runCommand/RunCommands_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_delete.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_delete.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_delete.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_delete.py index bf72def6f2b9..fa2559e465f5 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_delete.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_delete.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) client.machine_run_commands.begin_delete( @@ -38,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/runCommand/RunCommands_Delete.json +# x-ms-original-file: 2025-09-16-preview/runCommand/RunCommands_Delete.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_get.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_get.py index 4f1a7ed3887c..60db2b38b977 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_run_commands.get( @@ -39,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/runCommand/RunCommands_Get.json +# x-ms-original-file: 2025-09-16-preview/runCommand/RunCommands_Get.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_list.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_list.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_list.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_list.py index 30bb9abc7ffe..050407c343c6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_command/run_commands_list.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/run_commands_list.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="{subscriptionId}", + subscription_id="SUBSCRIPTION_ID", ) response = client.machine_run_commands.list( @@ -39,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/runCommand/RunCommands_List.json +# x-ms-original-file: 2025-09-16-preview/runCommand/RunCommands_List.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_get.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_get.py similarity index 81% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_get.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_get.py index 5e43815c0835..767b501e85fe 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_get.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_get.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. # -------------------------------------------------------------------------- @@ -28,7 +27,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.settings.get( @@ -41,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/settings/SettingsGet.json +# x-ms-original-file: 2025-09-16-preview/settings/SettingsGet.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_patch.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_patch.py similarity index 86% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_patch.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_patch.py index 61d0a0fc9672..bd719e4801e5 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_patch.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_patch.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.settings.patch( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/settings/SettingsPatch.json +# x-ms-original-file: 2025-09-16-preview/settings/SettingsPatch.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_update.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_update.py similarity index 86% rename from sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_update.py rename to sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_update.py index 375a7a59067a..d2bfa8cea46b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings/settings_update.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_samples/settings_update.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. # -------------------------------------------------------------------------- @@ -28,7 +28,7 @@ def main(): client = HybridComputeManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-1111-2222-3333-444444444444", + subscription_id="SUBSCRIPTION_ID", ) response = client.settings.update( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/preview/2025-02-19-preview/examples/settings/SettingsUpdate.json +# x-ms-original-file: 2025-09-16-preview/settings/SettingsUpdate.json if __name__ == "__main__": main() diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/conftest.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/conftest.py index e7b636985ac6..ea52193e7424 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/conftest.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/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 diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management.py index 718a3ae618dd..d121f2b6bae9 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management.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 pytest @@ -25,7 +25,6 @@ def test_begin_upgrade_extensions(self, resource_group): resource_group_name=resource_group.name, machine_name="str", extension_upgrade_parameters={"extensionTargets": {"str": {"targetVersion": "str"}}}, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -64,7 +63,6 @@ def test_begin_setup_extensions(self, resource_group): } ] }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_async.py index 03c91d2cd527..ff27c9e91d39 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_async.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 pytest @@ -27,7 +27,6 @@ async def test_begin_upgrade_extensions(self, resource_group): resource_group_name=resource_group.name, machine_name="str", extension_upgrade_parameters={"extensionTargets": {"str": {"targetVersion": "str"}}}, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -68,7 +67,6 @@ async def test_begin_setup_extensions(self, resource_group): } ] }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations.py index 72dd533d438a..0451072b171e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations.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 pytest @@ -26,7 +26,6 @@ def test_extension_metadata_get(self, resource_group): publisher="str", extension_type="str", version="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_extension_metadata_list(self, resource_group): location="str", publisher="str", extension_type="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations_async.py index 7778fc8e316d..93a9ae9afd1a 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_operations_async.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 pytest @@ -27,7 +27,6 @@ async def test_extension_metadata_get(self, resource_group): publisher="str", extension_type="str", version="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_extension_metadata_list(self, resource_group): location="str", publisher="str", extension_type="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations.py index f5722529b172..fb77bbed2f9e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations.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 pytest @@ -26,7 +26,6 @@ def test_extension_metadata_v2_get(self, resource_group): publisher="str", extension_type="str", version="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -39,7 +38,6 @@ def test_extension_metadata_v2_list(self, resource_group): location="str", publisher="str", extension_type="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations_async.py index 000671faee33..a9d3575dead0 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_metadata_v2_operations_async.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 pytest @@ -27,7 +27,6 @@ async def test_extension_metadata_v2_get(self, resource_group): publisher="str", extension_type="str", version="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -40,7 +39,6 @@ async def test_extension_metadata_v2_list(self, resource_group): location="str", publisher="str", extension_type="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations.py index 63ef16ce8b6d..1738f71f548b 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations.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 pytest @@ -23,7 +23,6 @@ def setup_method(self, method): def test_extension_publisher_list(self, resource_group): response = self.client.extension_publisher.list( location="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations_async.py index 07495f94d56b..1346d1245c38 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_publisher_operations_async.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 pytest @@ -24,7 +24,6 @@ def setup_method(self, method): async def test_extension_publisher_list(self, resource_group): response = self.client.extension_publisher.list( location="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations.py index 04cc18c6ec54..252a9e105e83 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations.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 pytest @@ -24,7 +24,6 @@ def test_extension_type_list(self, resource_group): response = self.client.extension_type.list( location="str", publisher="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations_async.py index 2f9576ecfd39..01e36e3df63c 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_extension_type_operations_async.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 pytest @@ -25,7 +25,6 @@ async def test_extension_type_list(self, resource_group): response = self.client.extension_type.list( location="str", publisher="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations.py index 32102000454c..1b88f26de1dd 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations.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 pytest @@ -18,6 +18,17 @@ class TestHybridComputeManagementGatewaysOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_gateways_get(self, resource_group): + response = self.client.gateways.get( + resource_group_name=resource_group.name, + gateway_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_gateways_begin_create_or_update(self, resource_group): @@ -26,13 +37,15 @@ def test_gateways_begin_create_or_update(self, resource_group): gateway_name="str", parameters={ "location": "str", - "allowedFeatures": ["str"], - "gatewayEndpoint": "str", - "gatewayId": "str", - "gatewayType": "str", "id": "str", "name": "str", - "provisioningState": "str", + "properties": { + "allowedFeatures": ["str"], + "gatewayEndpoint": "str", + "gatewayId": "str", + "gatewayType": "str", + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -44,7 +57,6 @@ def test_gateways_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -56,20 +68,7 @@ def test_gateways_update(self, resource_group): response = self.client.gateways.update( resource_group_name=resource_group.name, gateway_name="str", - parameters={"allowedFeatures": ["str"], "tags": {"str": "str"}}, - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_gateways_get(self, resource_group): - response = self.client.gateways.get( - resource_group_name=resource_group.name, - gateway_name="str", - api_version="2025-02-19-preview", + parameters={"properties": {"allowedFeatures": ["str"]}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -81,7 +80,6 @@ def test_gateways_begin_delete(self, resource_group): response = self.client.gateways.begin_delete( resource_group_name=resource_group.name, gateway_name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -92,7 +90,6 @@ def test_gateways_begin_delete(self, resource_group): def test_gateways_list_by_resource_group(self, resource_group): response = self.client.gateways.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -101,9 +98,7 @@ def test_gateways_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_gateways_list_by_subscription(self, resource_group): - response = self.client.gateways.list_by_subscription( - api_version="2025-02-19-preview", - ) + response = self.client.gateways.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations_async.py index 23516f6f5b18..121a5346072d 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_gateways_operations_async.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 pytest @@ -19,6 +19,17 @@ class TestHybridComputeManagementGatewaysOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_gateways_get(self, resource_group): + response = await self.client.gateways.get( + resource_group_name=resource_group.name, + gateway_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_gateways_begin_create_or_update(self, resource_group): @@ -28,13 +39,15 @@ async def test_gateways_begin_create_or_update(self, resource_group): gateway_name="str", parameters={ "location": "str", - "allowedFeatures": ["str"], - "gatewayEndpoint": "str", - "gatewayId": "str", - "gatewayType": "str", "id": "str", "name": "str", - "provisioningState": "str", + "properties": { + "allowedFeatures": ["str"], + "gatewayEndpoint": "str", + "gatewayId": "str", + "gatewayType": "str", + "provisioningState": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -46,7 +59,6 @@ async def test_gateways_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -59,20 +71,7 @@ async def test_gateways_update(self, resource_group): response = await self.client.gateways.update( resource_group_name=resource_group.name, gateway_name="str", - parameters={"allowedFeatures": ["str"], "tags": {"str": "str"}}, - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_gateways_get(self, resource_group): - response = await self.client.gateways.get( - resource_group_name=resource_group.name, - gateway_name="str", - api_version="2025-02-19-preview", + parameters={"properties": {"allowedFeatures": ["str"]}, "tags": {"str": "str"}}, ) # please add some check logic here by yourself @@ -85,7 +84,6 @@ async def test_gateways_begin_delete(self, resource_group): await self.client.gateways.begin_delete( resource_group_name=resource_group.name, gateway_name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -97,7 +95,6 @@ async def test_gateways_begin_delete(self, resource_group): async def test_gateways_list_by_resource_group(self, resource_group): response = self.client.gateways.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -106,9 +103,7 @@ async def test_gateways_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_gateways_list_by_subscription(self, resource_group): - response = self.client.gateways.list_by_subscription( - api_version="2025-02-19-preview", - ) + response = self.client.gateways.list_by_subscription() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations.py index 4ed6097b749d..138942ac2cba 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations.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 pytest @@ -18,6 +18,18 @@ class TestHybridComputeManagementLicenseProfilesOperations(AzureMgmtRecordedTest def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_license_profiles_get(self, resource_group): + response = self.client.license_profiles.get( + resource_group_name=resource_group.name, + machine_name="str", + license_profile_name="default", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_license_profiles_begin_create_or_update(self, resource_group): @@ -26,26 +38,18 @@ def test_license_profiles_begin_create_or_update(self, resource_group): machine_name="str", parameters={ "location": "str", - "assignedLicense": "str", - "assignedLicenseImmutableId": "str", - "billingEndDate": "2020-02-20 00:00:00", - "billingStartDate": "2020-02-20 00:00:00", - "disenrollmentDate": "2020-02-20 00:00:00", - "enrollmentDate": "2020-02-20 00:00:00", - "error": { - "additionalInfo": [{"info": {}, "type": "str"}], - "code": "str", - "details": [...], - "message": "str", - "target": "str", - }, - "esuEligibility": "str", - "esuKeyState": "str", - "esuKeys": [{"licenseStatus": 0, "sku": "str"}], "id": "str", "name": "str", - "productFeatures": [ - { + "properties": { + "esuProfile": { + "assignedLicense": "str", + "assignedLicenseImmutableId": "str", + "esuEligibility": "str", + "esuKeyState": "str", + "esuKeys": [{"licenseStatus": 0, "sku": "str"}], + "serverType": "str", + }, + "productProfile": { "billingEndDate": "2020-02-20 00:00:00", "billingStartDate": "2020-02-20 00:00:00", "disenrollmentDate": "2020-02-20 00:00:00", @@ -57,15 +61,29 @@ def test_license_profiles_begin_create_or_update(self, resource_group): "message": "str", "target": "str", }, - "name": "str", + "productFeatures": [ + { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "name": "str", + "subscriptionStatus": "str", + } + ], + "productType": "str", "subscriptionStatus": "str", - } - ], - "productType": "str", - "provisioningState": "str", - "serverType": "str", - "softwareAssuranceCustomer": bool, - "subscriptionStatus": "str", + }, + "provisioningState": "str", + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -77,7 +95,6 @@ def test_license_profiles_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", license_profile_name="default", ).result() # call '.result()' to poll until service return final result @@ -91,40 +108,29 @@ def test_license_profiles_begin_update(self, resource_group): resource_group_name=resource_group.name, machine_name="str", parameters={ - "assignedLicense": "str", - "productFeatures": [{"name": "str", "subscriptionStatus": "str"}], - "productType": "str", - "softwareAssuranceCustomer": bool, - "subscriptionStatus": "str", + "properties": { + "esuProfile": {"assignedLicense": "str"}, + "productProfile": { + "productFeatures": [{"name": "str", "subscriptionStatus": "str"}], + "productType": "str", + "subscriptionStatus": "str", + }, + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, "tags": {"str": "str"}, }, - api_version="2025-02-19-preview", license_profile_name="default", ).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_license_profiles_get(self, resource_group): - response = self.client.license_profiles.get( - resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-preview", - license_profile_name="default", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_license_profiles_begin_delete(self, resource_group): response = self.client.license_profiles.begin_delete( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", license_profile_name="default", ).result() # call '.result()' to poll until service return final result @@ -137,7 +143,6 @@ def test_license_profiles_list(self, resource_group): response = self.client.license_profiles.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations_async.py index 7dbcaca6ad5a..9fa726460883 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_license_profiles_operations_async.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 pytest @@ -19,6 +19,18 @@ class TestHybridComputeManagementLicenseProfilesOperationsAsync(AzureMgmtRecorde def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_license_profiles_get(self, resource_group): + response = await self.client.license_profiles.get( + resource_group_name=resource_group.name, + machine_name="str", + license_profile_name="default", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_license_profiles_begin_create_or_update(self, resource_group): @@ -28,26 +40,18 @@ async def test_license_profiles_begin_create_or_update(self, resource_group): machine_name="str", parameters={ "location": "str", - "assignedLicense": "str", - "assignedLicenseImmutableId": "str", - "billingEndDate": "2020-02-20 00:00:00", - "billingStartDate": "2020-02-20 00:00:00", - "disenrollmentDate": "2020-02-20 00:00:00", - "enrollmentDate": "2020-02-20 00:00:00", - "error": { - "additionalInfo": [{"info": {}, "type": "str"}], - "code": "str", - "details": [...], - "message": "str", - "target": "str", - }, - "esuEligibility": "str", - "esuKeyState": "str", - "esuKeys": [{"licenseStatus": 0, "sku": "str"}], "id": "str", "name": "str", - "productFeatures": [ - { + "properties": { + "esuProfile": { + "assignedLicense": "str", + "assignedLicenseImmutableId": "str", + "esuEligibility": "str", + "esuKeyState": "str", + "esuKeys": [{"licenseStatus": 0, "sku": "str"}], + "serverType": "str", + }, + "productProfile": { "billingEndDate": "2020-02-20 00:00:00", "billingStartDate": "2020-02-20 00:00:00", "disenrollmentDate": "2020-02-20 00:00:00", @@ -59,15 +63,29 @@ async def test_license_profiles_begin_create_or_update(self, resource_group): "message": "str", "target": "str", }, - "name": "str", + "productFeatures": [ + { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "name": "str", + "subscriptionStatus": "str", + } + ], + "productType": "str", "subscriptionStatus": "str", - } - ], - "productType": "str", - "provisioningState": "str", - "serverType": "str", - "softwareAssuranceCustomer": bool, - "subscriptionStatus": "str", + }, + "provisioningState": "str", + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -79,7 +97,6 @@ async def test_license_profiles_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", license_profile_name="default", ) ).result() # call '.result()' to poll until service return final result @@ -95,14 +112,17 @@ async def test_license_profiles_begin_update(self, resource_group): resource_group_name=resource_group.name, machine_name="str", parameters={ - "assignedLicense": "str", - "productFeatures": [{"name": "str", "subscriptionStatus": "str"}], - "productType": "str", - "softwareAssuranceCustomer": bool, - "subscriptionStatus": "str", + "properties": { + "esuProfile": {"assignedLicense": "str"}, + "productProfile": { + "productFeatures": [{"name": "str", "subscriptionStatus": "str"}], + "productType": "str", + "subscriptionStatus": "str", + }, + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, "tags": {"str": "str"}, }, - api_version="2025-02-19-preview", license_profile_name="default", ) ).result() # call '.result()' to poll until service return final result @@ -110,19 +130,6 @@ async def test_license_profiles_begin_update(self, resource_group): # please add some check logic here by yourself # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_license_profiles_get(self, resource_group): - response = await self.client.license_profiles.get( - resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-preview", - license_profile_name="default", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_license_profiles_begin_delete(self, resource_group): @@ -130,7 +137,6 @@ async def test_license_profiles_begin_delete(self, resource_group): await self.client.license_profiles.begin_delete( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", license_profile_name="default", ) ).result() # call '.result()' to poll until service return final result @@ -144,7 +150,6 @@ async def test_license_profiles_list(self, resource_group): response = self.client.license_profiles.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations.py index 0981e488fe40..61a3922a4c58 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations.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 pytest @@ -20,38 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_licenses_begin_validate_license(self, resource_group): - response = self.client.licenses.begin_validate_license( - parameters={ - "location": "str", - "id": "str", - "licenseDetails": { - "assignedLicenses": 0, - "edition": "str", - "immutableId": "str", - "processors": 0, - "state": "str", - "target": "str", - "type": "str", - "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], - }, - "licenseType": "str", - "name": "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"}, - "tenantId": "str", - "type": "str", - }, - api_version="2025-02-19-preview", - ).result() # call '.result()' to poll until service return final result + def test_licenses_get(self, resource_group): + response = self.client.licenses.get( + resource_group_name=resource_group.name, + license_name="str", + ) # please add some check logic here by yourself # ... @@ -65,19 +38,22 @@ def test_licenses_begin_create_or_update(self, resource_group): parameters={ "location": "str", "id": "str", - "licenseDetails": { - "assignedLicenses": 0, - "edition": "str", - "immutableId": "str", - "processors": 0, - "state": "str", - "target": "str", - "type": "str", - "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], - }, - "licenseType": "str", "name": "str", - "provisioningState": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -87,10 +63,8 @@ def test_licenses_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -103,39 +77,29 @@ def test_licenses_begin_update(self, resource_group): resource_group_name=resource_group.name, license_name="str", parameters={ - "edition": "str", - "licenseType": "str", - "processors": 0, - "state": "str", + "properties": { + "licenseDetails": { + "edition": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + }, + "licenseType": "str", + }, "tags": {"str": "str"}, - "target": "str", - "type": "str", }, - api_version="2025-02-19-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_licenses_get(self, resource_group): - response = self.client.licenses.get( - resource_group_name=resource_group.name, - license_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_licenses_begin_delete(self, resource_group): response = self.client.licenses.begin_delete( resource_group_name=resource_group.name, license_name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -146,7 +110,6 @@ def test_licenses_begin_delete(self, resource_group): def test_licenses_list_by_resource_group(self, resource_group): response = self.client.licenses.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -155,9 +118,46 @@ def test_licenses_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_licenses_list_by_subscription(self, resource_group): - response = self.client.licenses.list_by_subscription( - api_version="2025-02-19-preview", - ) + response = self.client.licenses.list_by_subscription() result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_licenses_begin_validate_license(self, resource_group): + response = self.client.licenses.begin_validate_license( + parameters={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "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"}, + "type": "str", + }, + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations_async.py index 9a08fbecd50c..ca99d763a652 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_licenses_operations_async.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 pytest @@ -21,40 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_licenses_begin_validate_license(self, resource_group): - response = await ( - await self.client.licenses.begin_validate_license( - parameters={ - "location": "str", - "id": "str", - "licenseDetails": { - "assignedLicenses": 0, - "edition": "str", - "immutableId": "str", - "processors": 0, - "state": "str", - "target": "str", - "type": "str", - "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], - }, - "licenseType": "str", - "name": "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"}, - "tenantId": "str", - "type": "str", - }, - api_version="2025-02-19-preview", - ) - ).result() # call '.result()' to poll until service return final result + async def test_licenses_get(self, resource_group): + response = await self.client.licenses.get( + resource_group_name=resource_group.name, + license_name="str", + ) # please add some check logic here by yourself # ... @@ -69,19 +40,22 @@ async def test_licenses_begin_create_or_update(self, resource_group): parameters={ "location": "str", "id": "str", - "licenseDetails": { - "assignedLicenses": 0, - "edition": "str", - "immutableId": "str", - "processors": 0, - "state": "str", - "target": "str", - "type": "str", - "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], - }, - "licenseType": "str", "name": "str", - "provisioningState": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -91,10 +65,8 @@ async def test_licenses_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -109,33 +81,24 @@ async def test_licenses_begin_update(self, resource_group): resource_group_name=resource_group.name, license_name="str", parameters={ - "edition": "str", - "licenseType": "str", - "processors": 0, - "state": "str", + "properties": { + "licenseDetails": { + "edition": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + }, + "licenseType": "str", + }, "tags": {"str": "str"}, - "target": "str", - "type": "str", }, - api_version="2025-02-19-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_licenses_get(self, resource_group): - response = await self.client.licenses.get( - resource_group_name=resource_group.name, - license_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_licenses_begin_delete(self, resource_group): @@ -143,7 +106,6 @@ async def test_licenses_begin_delete(self, resource_group): await self.client.licenses.begin_delete( resource_group_name=resource_group.name, license_name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -155,7 +117,6 @@ async def test_licenses_begin_delete(self, resource_group): async def test_licenses_list_by_resource_group(self, resource_group): response = self.client.licenses.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -164,9 +125,48 @@ async def test_licenses_list_by_resource_group(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_licenses_list_by_subscription(self, resource_group): - response = self.client.licenses.list_by_subscription( - api_version="2025-02-19-preview", - ) + response = self.client.licenses.list_by_subscription() 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_licenses_begin_validate_license(self, resource_group): + response = await ( + await self.client.licenses.begin_validate_license( + parameters={ + "location": "str", + "id": "str", + "name": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "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"}, + "type": "str", + }, + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations.py index 9975a0b1d642..c90316a00bd9 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations.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 pytest @@ -18,6 +18,18 @@ class TestHybridComputeManagementMachineExtensionsOperations(AzureMgmtRecordedTe def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machine_extensions_get(self, resource_group): + response = self.client.machine_extensions.get( + resource_group_name=resource_group.name, + machine_name="str", + extension_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_machine_extensions_begin_create_or_update(self, resource_group): @@ -63,7 +75,6 @@ def test_machine_extensions_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -77,17 +88,18 @@ def test_machine_extensions_begin_update(self, resource_group): machine_name="str", extension_name="str", extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {"str": {}}, - "publisher": "str", - "settings": {"str": {}}, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {"str": {}}, + "publisher": "str", + "settings": {"str": {}}, + "type": "str", + "typeHandlerVersion": "str", + }, "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -100,32 +112,17 @@ def test_machine_extensions_begin_delete(self, resource_group): resource_group_name=resource_group.name, machine_name="str", extension_name="str", - api_version="2025-02-19-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_machine_extensions_get(self, resource_group): - response = self.client.machine_extensions.get( - resource_group_name=resource_group.name, - machine_name="str", - extension_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_machine_extensions_list(self, resource_group): response = self.client.machine_extensions.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations_async.py index 7096d87cde0a..0c9ac73962f6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_extensions_operations_async.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 pytest @@ -19,6 +19,18 @@ class TestHybridComputeManagementMachineExtensionsOperationsAsync(AzureMgmtRecor def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machine_extensions_get(self, resource_group): + response = await self.client.machine_extensions.get( + resource_group_name=resource_group.name, + machine_name="str", + extension_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_machine_extensions_begin_create_or_update(self, resource_group): @@ -65,7 +77,6 @@ async def test_machine_extensions_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -81,17 +92,18 @@ async def test_machine_extensions_begin_update(self, resource_group): machine_name="str", extension_name="str", extension_parameters={ - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {"str": {}}, - "publisher": "str", - "settings": {"str": {}}, + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {"str": {}}, + "publisher": "str", + "settings": {"str": {}}, + "type": "str", + "typeHandlerVersion": "str", + }, "tags": {"str": "str"}, - "type": "str", - "typeHandlerVersion": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -106,33 +118,18 @@ async def test_machine_extensions_begin_delete(self, resource_group): resource_group_name=resource_group.name, machine_name="str", extension_name="str", - api_version="2025-02-19-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_machine_extensions_get(self, resource_group): - response = await self.client.machine_extensions.get( - resource_group_name=resource_group.name, - machine_name="str", - extension_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_machine_extensions_list(self, resource_group): response = self.client.machine_extensions.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations.py index 83b76097074d..2e05b0ec103d 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations.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 pytest @@ -18,6 +18,18 @@ class TestHybridComputeManagementMachineRunCommandsOperations(AzureMgmtRecordedT def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machine_run_commands_get(self, resource_group): + response = self.client.machine_run_commands.get( + resource_group_name=resource_group.name, + machine_name="str", + run_command_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_machine_run_commands_begin_create_or_update(self, resource_group): @@ -27,41 +39,44 @@ def test_machine_run_commands_begin_create_or_update(self, resource_group): run_command_name="str", run_command_properties={ "location": "str", - "asyncExecution": False, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", "id": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, "name": "str", - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "script": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "script": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -72,10 +87,8 @@ def test_machine_run_commands_begin_create_or_update(self, resource_group): "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeoutInSeconds": 0, "type": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -88,32 +101,17 @@ def test_machine_run_commands_begin_delete(self, resource_group): resource_group_name=resource_group.name, machine_name="str", run_command_name="str", - api_version="2025-02-19-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_machine_run_commands_get(self, resource_group): - response = self.client.machine_run_commands.get( - resource_group_name=resource_group.name, - machine_name="str", - run_command_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_machine_run_commands_list(self, resource_group): response = self.client.machine_run_commands.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations_async.py index a168f34476bc..42b48201f9be 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machine_run_commands_operations_async.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 pytest @@ -19,6 +19,18 @@ class TestHybridComputeManagementMachineRunCommandsOperationsAsync(AzureMgmtReco def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machine_run_commands_get(self, resource_group): + response = await self.client.machine_run_commands.get( + resource_group_name=resource_group.name, + machine_name="str", + run_command_name="str", + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_machine_run_commands_begin_create_or_update(self, resource_group): @@ -29,41 +41,44 @@ async def test_machine_run_commands_begin_create_or_update(self, resource_group) run_command_name="str", run_command_properties={ "location": "str", - "asyncExecution": False, - "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "errorBlobUri": "str", "id": "str", - "instanceView": { - "endTime": "2020-02-20 00:00:00", - "error": "str", - "executionMessage": "str", - "executionState": "str", - "exitCode": 0, - "output": "str", - "startTime": "2020-02-20 00:00:00", - "statuses": [ - { - "code": "str", - "displayStatus": "str", - "level": "str", - "message": "str", - "time": "2020-02-20 00:00:00", - } - ], - }, "name": "str", - "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, - "outputBlobUri": "str", - "parameters": [{"name": "str", "value": "str"}], - "protectedParameters": [{"name": "str", "value": "str"}], - "provisioningState": "str", - "runAsPassword": "str", - "runAsUser": "str", - "source": { - "commandId": "str", - "script": "str", - "scriptUri": "str", - "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + "properties": { + "asyncExecution": bool, + "errorBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "errorBlobUri": "str", + "instanceView": { + "endTime": "2020-02-20 00:00:00", + "error": "str", + "executionMessage": "str", + "executionState": "str", + "exitCode": 0, + "output": "str", + "startTime": "2020-02-20 00:00:00", + "statuses": [ + { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + } + ], + }, + "outputBlobManagedIdentity": {"clientId": "str", "objectId": "str"}, + "outputBlobUri": "str", + "parameters": [{"name": "str", "value": "str"}], + "protectedParameters": [{"name": "str", "value": "str"}], + "provisioningState": "str", + "runAsPassword": "str", + "runAsUser": "str", + "source": { + "commandId": "str", + "script": "str", + "scriptUri": "str", + "scriptUriManagedIdentity": {"clientId": "str", "objectId": "str"}, + }, + "timeoutInSeconds": 0, }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -74,10 +89,8 @@ async def test_machine_run_commands_begin_create_or_update(self, resource_group) "lastModifiedByType": "str", }, "tags": {"str": "str"}, - "timeoutInSeconds": 0, "type": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -92,33 +105,18 @@ async def test_machine_run_commands_begin_delete(self, resource_group): resource_group_name=resource_group.name, machine_name="str", run_command_name="str", - api_version="2025-02-19-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_machine_run_commands_get(self, resource_group): - response = await self.client.machine_run_commands.get( - resource_group_name=resource_group.name, - machine_name="str", - run_command_name="str", - api_version="2025-02-19-preview", - ) - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_machine_run_commands_list(self, resource_group): response = self.client.machine_run_commands.list( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations.py index 2bc944951a43..289430ce1a30 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations.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 pytest @@ -18,13 +18,378 @@ class TestHybridComputeManagementMachinesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_get(self, resource_group): + response = self.client.machines.get( + resource_group_name=resource_group.name, + machine_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_create_or_update(self, resource_group): + response = self.client.machines.create_or_update( + resource_group_name=resource_group.name, + machine_name="str", + parameters={ + "location": "str", + "id": "str", + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "kind": "str", + "name": "str", + "properties": { + "adFqdn": "str", + "agentConfiguration": { + "configMode": "str", + "extensionsAllowList": [{"publisher": "str", "type": "str"}], + "extensionsBlockList": [{"publisher": "str", "type": "str"}], + "extensionsEnabled": "str", + "guestConfigurationEnabled": "str", + "incomingConnectionsPorts": ["str"], + "proxyBypass": ["str"], + "proxyUrl": "str", + }, + "agentUpgrade": { + "correlationId": "str", + "desiredVersion": "str", + "enableAutomaticUpgrade": bool, + "lastAttemptDesiredVersion": "str", + "lastAttemptMessage": "str", + "lastAttemptStatus": "str", + "lastAttemptTimestamp": "2020-02-20 00:00:00", + }, + "agentVersion": "str", + "clientPublicKey": "str", + "cloudMetadata": {"provider": "str"}, + "detectedProperties": {"str": "str"}, + "displayName": "str", + "dnsFqdn": "str", + "domainName": "str", + "errorDetails": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "extensions": [ + { + "name": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + } + ], + "firmwareProfile": {"serialNumber": "str", "type": "str"}, + "hardwareProfile": { + "numberOfCpuSockets": 0, + "processors": [{"name": "str", "numberOfCores": 0}], + "totalPhysicalMemoryInBytes": 0, + }, + "hardwareResourceId": "str", + "identityKeyStore": "str", + "lastStatusChange": "2020-02-20 00:00:00", + "licenseProfile": { + "esuProfile": { + "assignedLicense": { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "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"}, + "type": "str", + }, + "assignedLicenseImmutableId": "str", + "esuEligibility": "str", + "esuKeyState": "str", + "esuKeys": [{"licenseStatus": 0, "sku": "str"}], + "licenseAssignmentState": "str", + "serverType": "str", + }, + "licenseChannel": "str", + "licenseStatus": "str", + "productProfile": { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "productFeatures": [ + { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "name": "str", + "subscriptionStatus": "str", + } + ], + "productType": "str", + "subscriptionStatus": "str", + }, + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, + "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"}, + "machineFqdn": "str", + "mssqlDiscovered": "str", + "networkProfile": { + "networkInterfaces": [ + { + "id": "str", + "ipAddresses": [ + {"address": "str", "ipAddressVersion": "str", "subnet": {"addressPrefix": "str"}} + ], + "macAddress": "str", + "name": "str", + } + ] + }, + "osEdition": "str", + "osName": "str", + "osProfile": { + "computerName": "str", + "linuxConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + "windowsConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + }, + "osSku": "str", + "osType": "str", + "osVersion": "str", + "parentClusterResourceId": "str", + "privateLinkScopeResourceId": "str", + "provisioningState": "str", + "serviceStatuses": { + "extensionService": {"startupType": "str", "status": "str"}, + "guestConfigurationService": {"startupType": "str", "status": "str"}, + }, + "status": "str", + "storageProfile": { + "disks": [ + { + "diskType": "str", + "generatedId": "str", + "id": "str", + "maxSizeInBytes": 0, + "name": "str", + "path": "str", + "usedSpaceInBytes": 0, + } + ] + }, + "tpmEkCertificate": "str", + "vmId": "str", + "vmUuid": "str", + }, + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {"str": {}}, + "provisioningState": "str", + "publisher": "str", + "settings": {"str": {}}, + "type": "str", + "typeHandlerVersion": "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"}, + "type": "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"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_update(self, resource_group): + response = self.client.machines.update( + resource_group_name=resource_group.name, + machine_name="str", + parameters={ + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "kind": "str", + "properties": { + "agentUpgrade": { + "correlationId": "str", + "desiredVersion": "str", + "enableAutomaticUpgrade": bool, + "lastAttemptDesiredVersion": "str", + "lastAttemptMessage": "str", + "lastAttemptStatus": "str", + "lastAttemptTimestamp": "2020-02-20 00:00:00", + }, + "cloudMetadata": {"provider": "str"}, + "identityKeyStore": "str", + "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"}, + "osProfile": { + "computerName": "str", + "linuxConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + "windowsConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + }, + "parentClusterResourceId": "str", + "privateLinkScopeResourceId": "str", + "tpmEkCertificate": "str", + }, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_machines_begin_delete(self, resource_group): response = self.client.machines.begin_delete( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -32,13 +397,19 @@ def test_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_machines_get(self, resource_group): - response = self.client.machines.get( + def test_machines_list_by_resource_group(self, resource_group): + response = self.client.machines.list_by_resource_group( resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-preview", ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_machines_list_by_subscription(self, resource_group): + response = self.client.machines.list_by_subscription() + result = [r for r in response] # please add some check logic here by yourself # ... @@ -48,7 +419,6 @@ def test_machines_begin_assess_patches(self, resource_group): response = self.client.machines.begin_assess_patches( resource_group_name=resource_group.name, name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -78,29 +448,7 @@ def test_machines_begin_install_patches(self, resource_group): "patchNameMasksToInclude": ["str"], }, }, - api_version="2025-02-19-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_machines_list_by_resource_group(self, resource_group): - response = self.client.machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-02-19-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_machines_list_by_subscription(self, resource_group): - response = self.client.machines.list_by_subscription( - api_version="2025-02-19-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations_async.py index 7bd803d3f2f1..872106c6ae17 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_machines_operations_async.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 pytest @@ -19,6 +19,372 @@ class TestHybridComputeManagementMachinesOperationsAsync(AzureMgmtRecordedTestCa def setup_method(self, method): self.client = self.create_mgmt_client(HybridComputeManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machines_get(self, resource_group): + response = await self.client.machines.get( + resource_group_name=resource_group.name, + machine_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machines_create_or_update(self, resource_group): + response = await self.client.machines.create_or_update( + resource_group_name=resource_group.name, + machine_name="str", + parameters={ + "location": "str", + "id": "str", + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "kind": "str", + "name": "str", + "properties": { + "adFqdn": "str", + "agentConfiguration": { + "configMode": "str", + "extensionsAllowList": [{"publisher": "str", "type": "str"}], + "extensionsBlockList": [{"publisher": "str", "type": "str"}], + "extensionsEnabled": "str", + "guestConfigurationEnabled": "str", + "incomingConnectionsPorts": ["str"], + "proxyBypass": ["str"], + "proxyUrl": "str", + }, + "agentUpgrade": { + "correlationId": "str", + "desiredVersion": "str", + "enableAutomaticUpgrade": bool, + "lastAttemptDesiredVersion": "str", + "lastAttemptMessage": "str", + "lastAttemptStatus": "str", + "lastAttemptTimestamp": "2020-02-20 00:00:00", + }, + "agentVersion": "str", + "clientPublicKey": "str", + "cloudMetadata": {"provider": "str"}, + "detectedProperties": {"str": "str"}, + "displayName": "str", + "dnsFqdn": "str", + "domainName": "str", + "errorDetails": [ + { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + } + ], + "extensions": [ + { + "name": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + } + ], + "firmwareProfile": {"serialNumber": "str", "type": "str"}, + "hardwareProfile": { + "numberOfCpuSockets": 0, + "processors": [{"name": "str", "numberOfCores": 0}], + "totalPhysicalMemoryInBytes": 0, + }, + "hardwareResourceId": "str", + "identityKeyStore": "str", + "lastStatusChange": "2020-02-20 00:00:00", + "licenseProfile": { + "esuProfile": { + "assignedLicense": { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "licenseDetails": { + "assignedLicenses": 0, + "edition": "str", + "immutableId": "str", + "processors": 0, + "state": "str", + "target": "str", + "type": "str", + "volumeLicenseDetails": [{"invoiceId": "str", "programYear": "str"}], + }, + "licenseType": "str", + "provisioningState": "str", + "tenantId": "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"}, + "type": "str", + }, + "assignedLicenseImmutableId": "str", + "esuEligibility": "str", + "esuKeyState": "str", + "esuKeys": [{"licenseStatus": 0, "sku": "str"}], + "licenseAssignmentState": "str", + "serverType": "str", + }, + "licenseChannel": "str", + "licenseStatus": "str", + "productProfile": { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "productFeatures": [ + { + "billingEndDate": "2020-02-20 00:00:00", + "billingStartDate": "2020-02-20 00:00:00", + "disenrollmentDate": "2020-02-20 00:00:00", + "enrollmentDate": "2020-02-20 00:00:00", + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "name": "str", + "subscriptionStatus": "str", + } + ], + "productType": "str", + "subscriptionStatus": "str", + }, + "softwareAssurance": {"softwareAssuranceCustomer": bool}, + }, + "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"}, + "machineFqdn": "str", + "mssqlDiscovered": "str", + "networkProfile": { + "networkInterfaces": [ + { + "id": "str", + "ipAddresses": [ + {"address": "str", "ipAddressVersion": "str", "subnet": {"addressPrefix": "str"}} + ], + "macAddress": "str", + "name": "str", + } + ] + }, + "osEdition": "str", + "osName": "str", + "osProfile": { + "computerName": "str", + "linuxConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + "windowsConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + }, + "osSku": "str", + "osType": "str", + "osVersion": "str", + "parentClusterResourceId": "str", + "privateLinkScopeResourceId": "str", + "provisioningState": "str", + "serviceStatuses": { + "extensionService": {"startupType": "str", "status": "str"}, + "guestConfigurationService": {"startupType": "str", "status": "str"}, + }, + "status": "str", + "storageProfile": { + "disks": [ + { + "diskType": "str", + "generatedId": "str", + "id": "str", + "maxSizeInBytes": 0, + "name": "str", + "path": "str", + "usedSpaceInBytes": 0, + } + ] + }, + "tpmEkCertificate": "str", + "vmId": "str", + "vmUuid": "str", + }, + "resources": [ + { + "location": "str", + "id": "str", + "name": "str", + "properties": { + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "instanceView": { + "name": "str", + "status": { + "code": "str", + "displayStatus": "str", + "level": "str", + "message": "str", + "time": "2020-02-20 00:00:00", + }, + "type": "str", + "typeHandlerVersion": "str", + }, + "protectedSettings": {"str": {}}, + "provisioningState": "str", + "publisher": "str", + "settings": {"str": {}}, + "type": "str", + "typeHandlerVersion": "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"}, + "type": "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"}, + "type": "str", + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_machines_update(self, resource_group): + response = await self.client.machines.update( + resource_group_name=resource_group.name, + machine_name="str", + parameters={ + "identity": {"principalId": "str", "tenantId": "str", "type": "str"}, + "kind": "str", + "properties": { + "agentUpgrade": { + "correlationId": "str", + "desiredVersion": "str", + "enableAutomaticUpgrade": bool, + "lastAttemptDesiredVersion": "str", + "lastAttemptMessage": "str", + "lastAttemptStatus": "str", + "lastAttemptTimestamp": "2020-02-20 00:00:00", + }, + "cloudMetadata": {"provider": "str"}, + "identityKeyStore": "str", + "locationData": {"name": "str", "city": "str", "countryOrRegion": "str", "district": "str"}, + "osProfile": { + "computerName": "str", + "linuxConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + "windowsConfiguration": { + "patchSettings": { + "assessmentMode": "str", + "enableHotpatching": bool, + "patchMode": "str", + "status": { + "error": { + "additionalInfo": [{"info": {}, "type": "str"}], + "code": "str", + "details": [...], + "message": "str", + "target": "str", + }, + "hotpatchEnablementStatus": "str", + }, + } + }, + }, + "parentClusterResourceId": "str", + "privateLinkScopeResourceId": "str", + "tpmEkCertificate": "str", + }, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_machines_begin_delete(self, resource_group): @@ -26,7 +392,6 @@ async def test_machines_begin_delete(self, resource_group): await self.client.machines.begin_delete( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -35,13 +400,19 @@ async def test_machines_begin_delete(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_machines_get(self, resource_group): - response = await self.client.machines.get( + async def test_machines_list_by_resource_group(self, resource_group): + response = self.client.machines.list_by_resource_group( resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-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_machines_list_by_subscription(self, resource_group): + response = self.client.machines.list_by_subscription() + result = [r async for r in response] # please add some check logic here by yourself # ... @@ -52,7 +423,6 @@ async def test_machines_begin_assess_patches(self, resource_group): await self.client.machines.begin_assess_patches( resource_group_name=resource_group.name, name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -84,30 +454,8 @@ async def test_machines_begin_install_patches(self, resource_group): "patchNameMasksToInclude": ["str"], }, }, - api_version="2025-02-19-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_machines_list_by_resource_group(self, resource_group): - response = self.client.machines.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2025-02-19-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_machines_list_by_subscription(self, resource_group): - response = self.client.machines.list_by_subscription( - api_version="2025-02-19-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations.py index 1102d5c0502f..936711fc00b1 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations.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 pytest @@ -24,7 +24,6 @@ def test_network_profile_get(self, resource_group): response = self.client.network_profile.get( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations_async.py index 226a922214f7..5537497417c3 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_profile_operations_async.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 pytest @@ -25,7 +25,6 @@ async def test_network_profile_get(self, resource_group): response = await self.client.network_profile.get( resource_group_name=resource_group.name, machine_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations.py index 5671cb7c448e..0f86196d4407 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations.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 pytest @@ -25,7 +25,6 @@ def test_network_security_perimeter_configurations_get_by_private_link_scope(sel resource_group_name=resource_group.name, scope_name="str", perimeter_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -37,7 +36,6 @@ def test_network_security_perimeter_configurations_list_by_private_link_scope(se response = self.client.network_security_perimeter_configurations.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -50,7 +48,6 @@ def test_network_security_perimeter_configurations_begin_reconcile_for_private_l resource_group_name=resource_group.name, scope_name="str", perimeter_name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations_async.py index 380beaeea83f..01d4001a4c2e 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_network_security_perimeter_configurations_operations_async.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 pytest @@ -26,7 +26,6 @@ async def test_network_security_perimeter_configurations_get_by_private_link_sco resource_group_name=resource_group.name, scope_name="str", perimeter_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -38,7 +37,6 @@ async def test_network_security_perimeter_configurations_list_by_private_link_sc response = self.client.network_security_perimeter_configurations.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -54,7 +52,6 @@ async def test_network_security_perimeter_configurations_begin_reconcile_for_pri resource_group_name=resource_group.name, scope_name="str", perimeter_name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations.py index dd54a4d7907c..134dea89512c 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations.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 pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-02-19-preview", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations_async.py index 8d5e86e01388..b50becadaab9 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_operations_async.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 pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2025-02-19-preview", - ) + response = self.client.operations.list() result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations.py index 2f47ad667236..8791508813e4 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations.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 pytest @@ -25,7 +25,6 @@ def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_endpoint_connection_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -61,7 +60,6 @@ def test_private_endpoint_connections_begin_create_or_update(self, resource_grou }, "type": "str", }, - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,7 +72,6 @@ def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_endpoint_connection_name="str", - api_version="2025-02-19-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -86,7 +83,6 @@ def test_private_endpoint_connections_list_by_private_link_scope(self, resource_ response = self.client.private_endpoint_connections.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations_async.py index b4f017eb8df4..e4eb02cf63a7 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_endpoint_connections_operations_async.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 pytest @@ -26,7 +26,6 @@ async def test_private_endpoint_connections_get(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_endpoint_connection_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -63,7 +62,6 @@ async def test_private_endpoint_connections_begin_create_or_update(self, resourc }, "type": "str", }, - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -78,7 +76,6 @@ async def test_private_endpoint_connections_begin_delete(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_endpoint_connection_name="str", - api_version="2025-02-19-preview", ) ).result() # call '.result()' to poll until service return final result @@ -91,7 +88,6 @@ async def test_private_endpoint_connections_list_by_private_link_scope(self, res response = self.client.private_endpoint_connections.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations.py index 376babc41a3d..d3192c2e12bf 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations.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 pytest @@ -20,25 +20,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_private_link_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_resources.list_by_private_link_scope( + def test_private_link_resources_get(self, resource_group): + response = self.client.private_link_resources.get( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", + group_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_private_link_resources_get(self, resource_group): - response = self.client.private_link_resources.get( + def test_private_link_resources_list_by_private_link_scope(self, resource_group): + response = self.client.private_link_resources.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - group_name="str", - api_version="2025-02-19-preview", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations_async.py index c3cf25a1f127..21501468fd30 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_resources_operations_async.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 pytest @@ -21,25 +21,23 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_private_link_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_resources.list_by_private_link_scope( + async def test_private_link_resources_get(self, resource_group): + response = await self.client.private_link_resources.get( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", + group_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_private_link_resources_get(self, resource_group): - response = await self.client.private_link_resources.get( + async def test_private_link_resources_list_by_private_link_scope(self, resource_group): + response = self.client.private_link_resources.list_by_private_link_scope( resource_group_name=resource_group.name, scope_name="str", - group_name="str", - api_version="2025-02-19-preview", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations.py index d312d8a4d959..e23862d2f7e1 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations.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 pytest @@ -20,33 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_private_link_scopes_list(self, resource_group): - response = self.client.private_link_scopes.list( - api_version="2025-02-19-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_list_by_resource_group(self, resource_group): - response = self.client.private_link_scopes.list_by_resource_group( + def test_private_link_scopes_get_validation_details_for_machine(self, resource_group): + response = self.client.private_link_scopes.get_validation_details_for_machine( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", + machine_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_private_link_scopes_begin_delete(self, resource_group): - response = self.client.private_link_scopes.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2025-02-19-preview", - ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -57,7 +35,6 @@ def test_private_link_scopes_get(self, resource_group): response = self.client.private_link_scopes.get( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -93,7 +70,10 @@ def test_private_link_scopes_create_or_update(self, resource_group): ], "privateLinkScopeId": "str", "provisioningState": "str", - "publicNetworkAccess": "Disabled", + "publicNetworkAccess": "str", + "serviceExtensions": [ + {"serviceExtensionPublicNetworkAccess": "str", "serviceExtensionType": "str"} + ], }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -106,7 +86,6 @@ def test_private_link_scopes_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -119,7 +98,6 @@ def test_private_link_scopes_update_tags(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_link_scope_tags={"tags": {"str": "str"}}, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -127,23 +105,39 @@ def test_private_link_scopes_update_tags(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_private_link_scopes_get_validation_details(self, resource_group): - response = self.client.private_link_scopes.get_validation_details( - location="str", - private_link_scope_id="str", - api_version="2025-02-19-preview", - ) + def test_private_link_scopes_begin_delete(self, resource_group): + response = self.client.private_link_scopes.begin_delete( + resource_group_name=resource_group.name, + scope_name="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_private_link_scopes_get_validation_details_for_machine(self, resource_group): - response = self.client.private_link_scopes.get_validation_details_for_machine( + def test_private_link_scopes_list_by_resource_group(self, resource_group): + response = self.client.private_link_scopes.list_by_resource_group( resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-preview", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_scopes_list(self, resource_group): + response = self.client.private_link_scopes.list() + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_private_link_scopes_get_validation_details(self, resource_group): + response = self.client.private_link_scopes.get_validation_details( + location="str", + private_link_scope_id="str", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations_async.py index 25ded0262ba0..efc6fc3f9045 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_private_link_scopes_operations_async.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 pytest @@ -21,35 +21,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_private_link_scopes_list(self, resource_group): - response = self.client.private_link_scopes.list( - api_version="2025-02-19-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_private_link_scopes_list_by_resource_group(self, resource_group): - response = self.client.private_link_scopes.list_by_resource_group( + async def test_private_link_scopes_get_validation_details_for_machine(self, resource_group): + response = await self.client.private_link_scopes.get_validation_details_for_machine( resource_group_name=resource_group.name, - api_version="2025-02-19-preview", + machine_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_private_link_scopes_begin_delete(self, resource_group): - response = await ( - await self.client.private_link_scopes.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2025-02-19-preview", - ) - ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... @@ -60,7 +36,6 @@ async def test_private_link_scopes_get(self, resource_group): response = await self.client.private_link_scopes.get( resource_group_name=resource_group.name, scope_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -96,7 +71,10 @@ async def test_private_link_scopes_create_or_update(self, resource_group): ], "privateLinkScopeId": "str", "provisioningState": "str", - "publicNetworkAccess": "Disabled", + "publicNetworkAccess": "str", + "serviceExtensions": [ + {"serviceExtensionPublicNetworkAccess": "str", "serviceExtensionType": "str"} + ], }, "systemData": { "createdAt": "2020-02-20 00:00:00", @@ -109,7 +87,6 @@ async def test_private_link_scopes_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -122,7 +99,6 @@ async def test_private_link_scopes_update_tags(self, resource_group): resource_group_name=resource_group.name, scope_name="str", private_link_scope_tags={"tags": {"str": "str"}}, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -130,23 +106,41 @@ async def test_private_link_scopes_update_tags(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_private_link_scopes_get_validation_details(self, resource_group): - response = await self.client.private_link_scopes.get_validation_details( - location="str", - private_link_scope_id="str", - api_version="2025-02-19-preview", - ) + async def test_private_link_scopes_begin_delete(self, resource_group): + response = await ( + await self.client.private_link_scopes.begin_delete( + resource_group_name=resource_group.name, + scope_name="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_private_link_scopes_get_validation_details_for_machine(self, resource_group): - response = await self.client.private_link_scopes.get_validation_details_for_machine( + async def test_private_link_scopes_list_by_resource_group(self, resource_group): + response = self.client.private_link_scopes.list_by_resource_group( resource_group_name=resource_group.name, - machine_name="str", - api_version="2025-02-19-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_private_link_scopes_list(self, resource_group): + response = self.client.private_link_scopes.list() + 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_private_link_scopes_get_validation_details(self, resource_group): + response = await self.client.private_link_scopes.get_validation_details( + location="str", + private_link_scope_id="str", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations.py index 142e1bef9ec2..9afec788a6cd 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations.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 pytest @@ -27,7 +27,6 @@ def test_settings_get(self, resource_group): base_resource_type="str", base_resource_name="str", settings_resource_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -43,9 +42,9 @@ def test_settings_update(self, resource_group): base_resource_name="str", settings_resource_name="str", parameters={ - "gatewayResourceId": "str", "id": "str", "name": "str", + "properties": {"gatewayProperties": {"gatewayResourceId": "str"}, "tenantId": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -54,10 +53,8 @@ def test_settings_update(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -73,9 +70,9 @@ def test_settings_patch(self, resource_group): base_resource_name="str", settings_resource_name="str", parameters={ - "gatewayResourceId": "str", "id": "str", "name": "str", + "properties": {"gatewayProperties": {"gatewayResourceId": "str"}, "tenantId": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -84,10 +81,8 @@ def test_settings_patch(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations_async.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations_async.py index e63e1de9f6b2..881362cde7a0 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations_async.py +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/generated_tests/test_hybrid_compute_management_settings_operations_async.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 pytest @@ -28,7 +28,6 @@ async def test_settings_get(self, resource_group): base_resource_type="str", base_resource_name="str", settings_resource_name="str", - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -44,9 +43,9 @@ async def test_settings_update(self, resource_group): base_resource_name="str", settings_resource_name="str", parameters={ - "gatewayResourceId": "str", "id": "str", "name": "str", + "properties": {"gatewayProperties": {"gatewayResourceId": "str"}, "tenantId": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -55,10 +54,8 @@ async def test_settings_update(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself @@ -74,9 +71,9 @@ async def test_settings_patch(self, resource_group): base_resource_name="str", settings_resource_name="str", parameters={ - "gatewayResourceId": "str", "id": "str", "name": "str", + "properties": {"gatewayProperties": {"gatewayResourceId": "str"}, "tenantId": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -85,10 +82,8 @@ async def test_settings_patch(self, resource_group): "lastModifiedBy": "str", "lastModifiedByType": "str", }, - "tenantId": "str", "type": "str", }, - api_version="2025-02-19-preview", ) # please add some check logic here by yourself diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml b/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml index 540da07d41af..03be87f2cfa6 100644 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/pyproject.toml @@ -1,6 +1,87 @@ +[build-system] +requires = [ + "setuptools>=77.0.3", + "wheel", +] +build-backend = "setuptools.build_meta" + +[project] +name = "azure-mgmt-hybridcompute" +authors = [ + { name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" }, +] +description = "Microsoft Azure Hybridcompute Management Client Library for Python" +license = "MIT" +classifiers = [ + "Development Status :: 4 - Beta", + "Programming Language :: Python", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", +] +requires-python = ">=3.10" +keywords = [ + "azure", + "azure sdk", +] +dependencies = [ + "isodate>=0.6.1", + "azure-mgmt-core>=1.6.0", + "typing-extensions>=4.6.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +repository = "https://github.com/Azure/azure-sdk-for-python" + +[tool.setuptools.dynamic.version] +attr = "azure.mgmt.hybridcompute._version.VERSION" + +[tool.setuptools.dynamic.readme] +file = [ + "README.md", + "CHANGELOG.md", +] +content-type = "text/markdown" + +[tool.setuptools.packages.find] +exclude = [ + "tests*", + "generated_tests*", + "samples*", + "generated_samples*", + "doc*", + "azure", + "azure.mgmt", +] + +[tool.setuptools.package-data] +pytyped = [ + "py.typed", +] + [tool.azure-sdk-build] breaking = false mypy = false pyright = false type_check_samples = false verifytypes = false + +[packaging] +package_name = "azure-mgmt-hybridcompute" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Hybrid Compute Management" +package_doc_id = "" +is_stable = false +is_arm = true +title = "HybridComputeManagementClient" +need_msrestazure = false +need_azuremgmtcore = true +sample_link = "" +exclude_folders = "" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/sdk_packaging.toml b/sdk/hybridcompute/azure-mgmt-hybridcompute/sdk_packaging.toml deleted file mode 100644 index c8660e2ce35d..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/sdk_packaging.toml +++ /dev/null @@ -1,8 +0,0 @@ -[packaging] -package_name = "azure-mgmt-hybridcompute" -package_nspkg = "azure-mgmt-nspkg" -package_pprint_name = "Hybrid Compute Management" -package_doc_id = "" -is_stable = false -is_arm = true -title = "HybridComputeManagementClient" diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py b/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py deleted file mode 100644 index 8051a1c71e22..000000000000 --- a/sdk/hybridcompute/azure-mgmt-hybridcompute/setup.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python - -# ------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- - -import re -import os.path -from io import open -from setuptools import find_packages, setup - -# Change the PACKAGE_NAME only to change folder and different name -PACKAGE_NAME = "azure-mgmt-hybridcompute" -PACKAGE_PPRINT_NAME = "Hybrid Compute Management" - -# a-b-c => a/b/c -package_folder_path = PACKAGE_NAME.replace("-", "/") -# a-b-c => a.b.c -namespace_name = PACKAGE_NAME.replace("-", ".") - -# Version extraction inspired from 'requests' -with open( - os.path.join(package_folder_path, "version.py") - if os.path.exists(os.path.join(package_folder_path, "version.py")) - else os.path.join(package_folder_path, "_version.py"), - "r", -) as fd: - version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1) - -if not version: - raise RuntimeError("Cannot find version information") - -with open("README.md", encoding="utf-8") as f: - readme = f.read() -with open("CHANGELOG.md", encoding="utf-8") as f: - changelog = f.read() - -setup( - name=PACKAGE_NAME, - version=version, - description="Microsoft Azure {} Client Library for Python".format(PACKAGE_PPRINT_NAME), - long_description=readme + "\n\n" + changelog, - long_description_content_type="text/markdown", - license="MIT License", - author="Microsoft Corporation", - author_email="azpysdkhelp@microsoft.com", - url="https://github.com/Azure/azure-sdk-for-python", - keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product - classifiers=[ - "Development Status :: 4 - Beta", - "Programming Language :: Python", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "License :: OSI Approved :: MIT License", - ], - zip_safe=False, - packages=find_packages( - exclude=[ - "tests", - # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.mgmt", - ] - ), - include_package_data=True, - package_data={ - "pytyped": ["py.typed"], - }, - install_requires=[ - "isodate>=0.6.1", - "typing-extensions>=4.6.0", - "azure-common>=1.1", - "azure-mgmt-core>=1.5.0", - ], - python_requires=">=3.9", -) diff --git a/sdk/hybridcompute/azure-mgmt-hybridcompute/tsp-location.yaml b/sdk/hybridcompute/azure-mgmt-hybridcompute/tsp-location.yaml new file mode 100644 index 000000000000..ad2b37c9151e --- /dev/null +++ b/sdk/hybridcompute/azure-mgmt-hybridcompute/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/hybridcompute/resource-manager/Microsoft.HybridCompute/HybridCompute +commit: ecd420c9534d0dab69be38027c1723031504b081 +repo: Azure/azure-rest-api-specs +additionalDirectories: