From fad7e73df835852e6d37c861ecc3916bf6e7cf81 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 14 May 2025 00:01:27 +0000 Subject: [PATCH] CodeGen from PR 34659 in Azure/azure-rest-api-specs Merge fff39c84516f040d6e6933f4fa4a78607c098bad into 778b6f8c84f4d62e66f054e3876acff30e5bd4f9 --- .../CHANGELOG.md | 548 + .../README.md | 6 +- .../_meta.json | 11 +- .../apiview-properties.json | 280 + .../servicefabricmanagedclusters/__init__.py | 4 +- ...usters_management_client.py => _client.py} | 120 +- .../_configuration.py | 25 +- .../_metadata.json | 114 - .../servicefabricmanagedclusters/_patch.py | 39 +- .../{_vendor.py => _utils/__init__.py} | 12 +- .../_utils/model_base.py | 1232 ++ .../serialization.py} | 194 +- .../servicefabricmanagedclusters/_version.py | 4 +- .../aio/__init__.py | 4 +- ...usters_management_client.py => _client.py} | 122 +- .../aio/_configuration.py | 25 +- .../aio/_patch.py | 39 +- .../aio/operations/__init__.py | 44 +- .../_application_type_versions_operations.py | 747 -- .../_application_types_operations.py | 627 - .../operations/_applications_operations.py | 1163 -- ...ged_apply_maintenance_window_operations.py | 108 - ...managed_az_resiliency_status_operations.py | 114 - .../_managed_cluster_version_operations.py | 304 - .../_managed_clusters_operations.py | 745 -- ...ed_maintenance_window_status_operations.py | 112 - ...managed_unsupported_vm_sizes_operations.py | 196 - .../operations/_node_type_skus_operations.py | 145 - .../aio/operations/_node_types_operations.py | 1422 -- .../_operation_results_operations.py | 111 - .../_operation_status_operations.py | 111 - .../aio/operations/_operations.py | 9274 ++++++++++++- .../aio/operations/_patch.py | 9 +- .../aio/operations/_services_operations.py | 743 -- .../models/__init__.py | 82 +- ...s_management_client_enums.py => _enums.py} | 157 +- .../models/_models.py | 8335 ++++++++---- .../models/_models_py3.py | 6302 --------- .../models/_patch.py | 9 +- .../operations/__init__.py | 44 +- .../_application_type_versions_operations.py | 929 -- .../_application_types_operations.py | 785 -- .../operations/_applications_operations.py | 1418 -- ...ged_apply_maintenance_window_operations.py | 142 - ...managed_az_resiliency_status_operations.py | 144 - .../_managed_cluster_version_operations.py | 429 - .../_managed_clusters_operations.py | 920 -- ...ed_maintenance_window_status_operations.py | 142 - ...managed_unsupported_vm_sizes_operations.py | 255 - .../operations/_node_type_skus_operations.py | 180 - .../operations/_node_types_operations.py | 1670 --- .../_operation_results_operations.py | 145 - .../_operation_status_operations.py | 143 - .../operations/_operations.py | 11059 +++++++++++++++- .../operations/_patch.py | 9 +- .../operations/_services_operations.py | 929 -- .../application_action_get_upgrade_example.py | 6 +- ...plication_action_resume_upgrade_example.py | 6 +- ...plication_action_start_rollback_example.py | 6 +- .../application_delete_operation_example.py | 6 +- .../application_get_operation_example.py | 6 +- .../application_list_operation_example.py | 6 +- .../application_patch_operation_example.py | 6 +- .../application_put_operation_example_max.py | 7 +- .../application_put_operation_example_min.py | 7 +- ...tion_type_name_delete_operation_example.py | 6 +- ...ication_type_name_get_operation_example.py | 6 +- ...cation_type_name_list_operation_example.py | 6 +- ...ation_type_name_patch_operation_example.py | 6 +- ...ication_type_name_put_operation_example.py | 6 +- ...n_type_version_delete_operation_example.py | 6 +- ...tion_type_version_get_operation_example.py | 6 +- ...ion_type_version_list_operation_example.py | 6 +- ...on_type_version_patch_operation_example.py | 6 +- ...tion_type_version_put_operation_example.py | 6 +- .../deallocate_nodes_example.py | 43 + .../generated_samples/delete_nodes_example.py | 6 +- ...d_apply_maintenance_window_post_example.py | 6 +- ...anaged_az_resiliency_status_get_example.py | 6 +- ...anaged_cluster_delete_operation_example.py | 6 +- .../managed_cluster_get_operation_example.py | 6 +- ...ist_by_resource_group_operation_example.py | 6 +- ..._list_by_subscription_operation_example.py | 6 +- ...managed_cluster_patch_operation_example.py | 6 +- ...naged_cluster_put_operation_example_max.py | 7 +- ...naged_cluster_put_operation_example_min.py | 6 +- ...ster_version_get_by_environment_example.py | 6 +- .../managed_cluster_version_get_example.py | 6 +- ...ged_cluster_version_list_by_environment.py | 6 +- .../managed_cluster_version_list_example.py | 6 +- ...d_maintenance_window_status_get_example.py | 6 +- ...anaged_unsupported_vm_sizes_get_example.py | 6 +- ...naged_unsupported_vm_sizes_list_example.py | 6 +- .../node_type_delete_operation_example.py | 6 +- .../node_type_get_operation_example.py | 6 +- .../node_type_list_operation_example.py | 6 +- ...type_patch_operation_auto_scale_example.py | 6 +- .../node_type_patch_operation_example.py | 6 +- ...e_type_put_operation_auto_scale_example.py | 7 +- ...type_put_operation_custom_image_example.py | 7 +- ...n_custom_shared_galleries_image_example.py | 7 +- ...pe_put_operation_dedicated_host_example.py | 7 +- .../node_type_put_operation_example_max.py | 10 +- .../node_type_put_operation_example_min.py | 6 +- ...de_type_put_operation_stateless_example.py | 6 +- ...ype_put_operation_vm_image_plan_example.py | 6 +- .../node_type_skus_list_operation_example.py | 6 +- ...lt.py => operation_results_get_example.py} | 12 +- ....py => operation_status_failed_example.py} | 8 +- ... => operation_status_succeeded_example.py} | 8 +- ..._example.py => operations_list_example.py} | 8 +- .../redeploy_nodes_example.py | 43 + .../redeploy_nodes_ud_example.py | 43 + .../reimage_nodes_example.py | 6 +- .../reimage_nodes_ud_example.py | 6 +- .../restart_nodes_example.py | 6 +- .../service_delete_operation_example.py | 6 +- .../service_get_operation_example.py | 6 +- .../service_list_operation_example.py | 6 +- .../service_patch_operation_example.py | 6 +- .../service_put_operation_example_max.py | 7 +- .../service_put_operation_example_min.py | 6 +- .../generated_samples/start_nodes_example.py | 43 + .../generated_tests/conftest.py | 2 +- ...nt_application_type_versions_operations.py | 10 +- ...lication_type_versions_operations_async.py | 10 +- ...management_application_types_operations.py | 9 +- ...ment_application_types_operations_async.py | 9 +- ...ters_management_applications_operations.py | 156 +- ...anagement_applications_operations_async.py | 168 +- ...ged_apply_maintenance_window_operations.py | 3 +- ...ply_maintenance_window_operations_async.py | 3 +- ...managed_az_resiliency_status_operations.py | 3 +- ...d_az_resiliency_status_operations_async.py | 3 +- ...ment_managed_cluster_version_operations.py | 18 +- ...anaged_cluster_version_operations_async.py | 18 +- ..._management_managed_clusters_operations.py | 283 +- ...ement_managed_clusters_operations_async.py | 293 +- ...ed_maintenance_window_status_operations.py | 3 +- ...ntenance_window_status_operations_async.py | 3 +- ...managed_unsupported_vm_sizes_operations.py | 18 +- ...d_unsupported_vm_sizes_operations_async.py | 18 +- ...rs_management_node_type_skus_operations.py | 3 +- ...agement_node_type_skus_operations_async.py | 3 +- ...usters_management_node_types_operations.py | 416 +- ..._management_node_types_operations_async.py | 436 +- ...management_operation_results_operations.py | 9 +- ...ment_operation_results_operations_async.py | 15 +- ..._management_operation_status_operations.py | 3 +- ...ement_operation_status_operations_async.py | 3 +- ..._managed_clusters_management_operations.py | 6 +- ...ed_clusters_management_operations_async.py | 6 +- ...clusters_management_services_operations.py | 7 +- ...rs_management_services_operations_async.py | 7 +- .../setup.py | 5 +- .../tsp-location.yaml | 4 + 156 files changed, 30148 insertions(+), 25361 deletions(-) create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/apiview-properties.json rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/{_service_fabric_managed_clusters_management_client.py => _client.py} (83%) delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/{_vendor.py => _utils/__init__.py} (50%) create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/model_base.py rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/{_serialization.py => _utils/serialization.py} (93%) rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/{_service_fabric_managed_clusters_management_client.py => _client.py} (83%) delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/{_service_fabric_managed_clusters_management_client_enums.py => _enums.py} (75%) delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py delete mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/deallocate_nodes_example.py rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/{long_running_operation_result.py => operation_results_get_example.py} (77%) rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/{long_running_operation_status_failed.py => operation_status_failed_example.py} (79%) rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/{long_running_operation_status_succeeded.py => operation_status_succeeded_example.py} (78%) rename sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/{operations_example.py => operations_list_example.py} (80%) create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_example.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_ud_example.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/start_nodes_example.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/tsp-location.yaml diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md index db4c47f7f45c..b3adda860025 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md @@ -1,5 +1,553 @@ # Release History +## 2.1.0b3 (2025-05-14) + +### Features Added + + - Client `ServiceFabricManagedClustersManagementClient` added method `send_request` + - Model `ApplicationResource` added property `properties` + - Model `ApplicationTypeResource` added property `properties` + - Model `ApplicationTypeVersionResource` added property `properties` + - Enum `DiskType` added member `PREMIUM_V2_LRS` + - Enum `DiskType` added member `PREMIUM_ZRS` + - Enum `DiskType` added member `STANDARD_SSD_ZRS` + - Model `ManagedCluster` added property `properties` + - Model `ManagedClusterCodeVersionResult` added property `properties` + - Model `NodeType` added property `properties` + - Enum `SecurityType` added member `CONFIDENTIAL_VM` + - Model `VMSSExtension` added property `properties` + - Added model `ApplicationResourceProperties` + - Added model `ApplicationTypeResourceProperties` + - Added model `ApplicationTypeVersionResourceProperties` + - Added enum `CreatedByType` + - Added model `ErrorAdditionalInfo` + - Added model `ErrorDetail` + - Added model `ErrorResponse` + - Added enum `FaultKind` + - Added model `FaultSimulation` + - Added model `FaultSimulationConstraints` + - Added model `FaultSimulationContent` + - Added model `FaultSimulationContentWrapper` + - Added model `FaultSimulationDetails` + - Added model `FaultSimulationIdContent` + - Added enum `FaultSimulationStatus` + - Added model `IPConfigurationPublicIPAddressConfiguration` + - Added model `ManagedClusterProperties` + - Added model `ManagedClusterVersionDetails` + - Added model `NodeTypeFaultSimulation` + - Added model `NodeTypeProperties` + - Added enum `SecurityEncryptionType` + - Added enum `SfmcOperationStatus` + - Added model `TrackedResource` + - Added model `VMSSExtensionProperties` + - Added model `ZoneFaultSimulationContent` + - Model `ManagedClustersOperations` added method `begin_start_fault_simulation` + - Model `ManagedClustersOperations` added method `begin_stop_fault_simulation` + - Model `ManagedClustersOperations` added method `get_fault_simulation` + - Model `ManagedClustersOperations` added method `list_fault_simulation` + - Model `NodeTypesOperations` added method `begin_deallocate` + - Model `NodeTypesOperations` added method `begin_redeploy` + - Model `NodeTypesOperations` added method `begin_start` + - Model `NodeTypesOperations` added method `begin_start_fault_simulation` + - Model `NodeTypesOperations` added method `begin_stop_fault_simulation` + - Model `NodeTypesOperations` added method `get_fault_simulation` + - Model `NodeTypesOperations` added method `list_fault_simulation` + - Model `OperationResultsOperations` added method `begin_get` + - Method `AddRemoveIncrementalNamedPartitionScalingMechanism.__init__` has a new overload `def __init__(self: None, min_partition_count: int, max_partition_count: int, scale_increment: int)` + - Method `AddRemoveIncrementalNamedPartitionScalingMechanism.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AddRemoveIncrementalNamedPartitionScalingMechanism.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `AddRemoveIncrementalNamedPartitionScalingMechanism.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AdditionalNetworkInterfaceConfiguration.__init__` has a new overload `def __init__(self: None, name: str, ip_configurations: List[_models.IpConfiguration], enable_accelerated_networking: Optional[bool], dscp_configuration: Optional[_models.SubResource])` + - Method `AdditionalNetworkInterfaceConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationHealthPolicy.__init__` has a new overload `def __init__(self: None, consider_warning_as_error: bool, max_percent_unhealthy_deployed_applications: int, default_service_type_health_policy: Optional[_models.ServiceTypeHealthPolicy], service_type_health_policy_map: Optional[Dict[str, _models.ServiceTypeHealthPolicy]])` + - Method `ApplicationHealthPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationResource.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ApplicationResourceProperties], tags: Optional[Dict[str, str]], identity: Optional[_models.ManagedIdentity], location: Optional[str])` + - Method `ApplicationResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeResource.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ApplicationTypeResourceProperties], tags: Optional[Dict[str, str]], location: Optional[str])` + - Method `ApplicationTypeResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]])` + - Method `ApplicationTypeUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeVersionResource.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ApplicationTypeVersionResourceProperties], tags: Optional[Dict[str, str]], location: Optional[str])` + - Method `ApplicationTypeVersionResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeVersionUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]])` + - Method `ApplicationTypeVersionUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeVersionsCleanupPolicy.__init__` has a new overload `def __init__(self: None, max_unused_versions_to_keep: int)` + - Method `ApplicationTypeVersionsCleanupPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]])` + - Method `ApplicationUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationUpgradePolicy.__init__` has a new overload `def __init__(self: None, application_health_policy: Optional[_models.ApplicationHealthPolicy], force_restart: Optional[bool], rolling_upgrade_monitoring_policy: Optional[_models.RollingUpgradeMonitoringPolicy], instance_close_delay_duration: Optional[int], upgrade_mode: Optional[Union[str, _models.RollingUpgradeMode]], upgrade_replica_set_check_timeout: Optional[int], recreate_application: Optional[bool])` + - Method `ApplicationUpgradePolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationUserAssignedIdentity.__init__` has a new overload `def __init__(self: None, name: str, principal_id: str)` + - Method `ApplicationUserAssignedIdentity.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AvailableOperationDisplay.__init__` has a new overload `def __init__(self: None, provider: Optional[str], resource: Optional[str], operation: Optional[str], description: Optional[str])` + - Method `AvailableOperationDisplay.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AveragePartitionLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, metric_name: str, lower_load_threshold: float, upper_load_threshold: float, scale_interval: str)` + - Method `AveragePartitionLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AveragePartitionLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `AveragePartitionLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AverageServiceLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, metric_name: str, lower_load_threshold: float, upper_load_threshold: float, scale_interval: str, use_only_primary_load: bool)` + - Method `AverageServiceLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AverageServiceLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `AverageServiceLoadScalingTrigger.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureActiveDirectory.__init__` has a new overload `def __init__(self: None, tenant_id: Optional[str], cluster_application: Optional[str], client_application: Optional[str])` + - Method `AzureActiveDirectory.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ClientCertificate.__init__` has a new overload `def __init__(self: None, is_admin: bool, thumbprint: Optional[str], common_name: Optional[str], issuer_thumbprint: Optional[str])` + - Method `ClientCertificate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ClusterHealthPolicy.__init__` has a new overload `def __init__(self: None, max_percent_unhealthy_nodes: int, max_percent_unhealthy_applications: int)` + - Method `ClusterHealthPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ClusterMonitoringPolicy.__init__` has a new overload `def __init__(self: None, health_check_wait_duration: str, health_check_stable_duration: str, health_check_retry_timeout: str, upgrade_timeout: str, upgrade_domain_timeout: str)` + - Method `ClusterMonitoringPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ClusterUpgradeDeltaHealthPolicy.__init__` has a new overload `def __init__(self: None, max_percent_delta_unhealthy_nodes: int, max_percent_upgrade_domain_delta_unhealthy_nodes: Optional[int], max_percent_delta_unhealthy_applications: Optional[int])` + - Method `ClusterUpgradeDeltaHealthPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ClusterUpgradePolicy.__init__` has a new overload `def __init__(self: None, force_restart: Optional[bool], health_policy: Optional[_models.ClusterHealthPolicy], delta_health_policy: Optional[_models.ClusterUpgradeDeltaHealthPolicy], monitoring_policy: Optional[_models.ClusterMonitoringPolicy], upgrade_replica_set_check_timeout: Optional[str])` + - Method `ClusterUpgradePolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `EndpointRangeDescription.__init__` has a new overload `def __init__(self: None, start_port: int, end_port: int)` + - Method `EndpointRangeDescription.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ErrorModelError.__init__` has a new overload `def __init__(self: None, code: Optional[str], message: Optional[str])` + - Method `ErrorModelError.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FrontendConfiguration.__init__` has a new overload `def __init__(self: None, ip_address_type: Optional[Union[str, _models.IPAddressType]], load_balancer_backend_address_pool_id: Optional[str], load_balancer_inbound_nat_pool_id: Optional[str], application_gateway_backend_address_pool_id: Optional[str])` + - Method `FrontendConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `IpConfiguration.__init__` has a new overload `def __init__(self: None, name: str, application_gateway_backend_address_pools: Optional[List[_models.SubResource]], load_balancer_backend_address_pools: Optional[List[_models.SubResource]], load_balancer_inbound_nat_pools: Optional[List[_models.SubResource]], subnet: Optional[_models.SubResource], private_ip_address_version: Optional[Union[str, _models.PrivateIPAddressVersion]], public_ip_address_configuration: Optional[_models.IPConfigurationPublicIPAddressConfiguration])` + - Method `IpConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `IpTag.__init__` has a new overload `def __init__(self: None, ip_tag_type: str, tag: str)` + - Method `IpTag.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `LoadBalancingRule.__init__` has a new overload `def __init__(self: None, frontend_port: int, backend_port: int, protocol: Union[str, _models.Protocol], probe_protocol: Union[str, _models.ProbeProtocol], probe_port: Optional[int], probe_request_path: Optional[str], load_distribution: Optional[str])` + - Method `LoadBalancingRule.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `LongRunningOperationResult.__init__` has a new overload `def __init__(self: None, name: Optional[str], start_time: Optional[datetime], end_time: Optional[datetime], percent_complete: Optional[float], status: Optional[str], error: Optional[_models.ErrorModelError])` + - Method `LongRunningOperationResult.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedAzResiliencyStatus.__init__` has a new overload `def __init__(self: None, base_resource_status: Optional[List[_models.ResourceAzStatus]])` + - Method `ManagedAzResiliencyStatus.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedCluster.__init__` has a new overload `def __init__(self: None, location: str, sku: _models.Sku, tags: Optional[Dict[str, str]], properties: Optional[_models.ManagedClusterProperties])` + - Method `ManagedCluster.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedCluster.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `ManagedCluster.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedClusterCodeVersionResult.__init__` has a new overload `def __init__(self: None, id: Optional[str], name: Optional[str], type: Optional[str], properties: Optional[_models.ManagedClusterVersionDetails])` + - Method `ManagedClusterCodeVersionResult.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedClusterUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]])` + - Method `ManagedClusterUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedIdentity.__init__` has a new overload `def __init__(self: None, type: Optional[Union[str, _models.ManagedIdentityType]], user_assigned_identities: Optional[Dict[str, _models.UserAssignedIdentity]])` + - Method `ManagedIdentity.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NamedPartitionScheme.__init__` has a new overload `def __init__(self: None, names: List[str])` + - Method `NamedPartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NamedPartitionScheme.__init__` has a new overload `def __init__(self: None, partition_scheme: str)` + - Method `NamedPartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NetworkSecurityRule.__init__` has a new overload `def __init__(self: None, name: str, protocol: Union[str, _models.NsgProtocol], access: Union[str, _models.Access], priority: int, direction: Union[str, _models.Direction], description: Optional[str], source_address_prefixes: Optional[List[str]], destination_address_prefixes: Optional[List[str]], source_port_ranges: Optional[List[str]], destination_port_ranges: Optional[List[str]], source_address_prefix: Optional[str], destination_address_prefix: Optional[str], source_port_range: Optional[str], destination_port_range: Optional[str])` + - Method `NetworkSecurityRule.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeType.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.NodeTypeProperties], tags: Optional[Dict[str, str]], sku: Optional[_models.NodeTypeSku])` + - Method `NodeType.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeActionParameters.__init__` has a new overload `def __init__(self: None, nodes: Optional[List[str]], force: Optional[bool], update_type: Optional[Union[str, _models.UpdateType]])` + - Method `NodeTypeActionParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeNatConfig.__init__` has a new overload `def __init__(self: None, backend_port: Optional[int], frontend_port_range_start: Optional[int], frontend_port_range_end: Optional[int])` + - Method `NodeTypeNatConfig.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeSku.__init__` has a new overload `def __init__(self: None, capacity: int, name: Optional[str], tier: Optional[str])` + - Method `NodeTypeSku.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]], sku: Optional[_models.NodeTypeSku])` + - Method `NodeTypeUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `OperationResult.__init__` has a new overload `def __init__(self: None, name: Optional[str], is_data_action: Optional[bool], display: Optional[_models.AvailableOperationDisplay], origin: Optional[str], next_link: Optional[str])` + - Method `OperationResult.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Partition.__init__` has a new overload `def __init__(self: None, partition_scheme: str)` + - Method `Partition.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PartitionInstanceCountScaleMechanism.__init__` has a new overload `def __init__(self: None, min_instance_count: int, max_instance_count: int, scale_increment: int)` + - Method `PartitionInstanceCountScaleMechanism.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PartitionInstanceCountScaleMechanism.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `PartitionInstanceCountScaleMechanism.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RollingUpgradeMonitoringPolicy.__init__` has a new overload `def __init__(self: None, failure_action: Union[str, _models.FailureAction], health_check_wait_duration: str, health_check_stable_duration: str, health_check_retry_timeout: str, upgrade_timeout: str, upgrade_domain_timeout: str)` + - Method `RollingUpgradeMonitoringPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RuntimeResumeApplicationUpgradeParameters.__init__` has a new overload `def __init__(self: None, upgrade_domain_name: Optional[str])` + - Method `RuntimeResumeApplicationUpgradeParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ScalingMechanism.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `ScalingMechanism.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ScalingPolicy.__init__` has a new overload `def __init__(self: None, scaling_mechanism: _models.ScalingMechanism, scaling_trigger: _models.ScalingTrigger)` + - Method `ScalingPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ScalingTrigger.__init__` has a new overload `def __init__(self: None, kind: str)` + - Method `ScalingTrigger.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceCorrelation.__init__` has a new overload `def __init__(self: None, scheme: Union[str, _models.ServiceCorrelationScheme], service_name: str)` + - Method `ServiceCorrelation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceEndpoint.__init__` has a new overload `def __init__(self: None, service: str, locations: Optional[List[str]])` + - Method `ServiceEndpoint.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceLoadMetric.__init__` has a new overload `def __init__(self: None, name: str, weight: Optional[Union[str, _models.ServiceLoadMetricWeight]], primary_default_load: Optional[int], secondary_default_load: Optional[int], default_load: Optional[int])` + - Method `ServiceLoadMetric.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementInvalidDomainPolicy.__init__` has a new overload `def __init__(self: None, domain_name: str)` + - Method `ServicePlacementInvalidDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementInvalidDomainPolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementInvalidDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementNonPartiallyPlaceServicePolicy.__init__` has a new overload `def __init__(self: None)` + - Method `ServicePlacementNonPartiallyPlaceServicePolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementNonPartiallyPlaceServicePolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementNonPartiallyPlaceServicePolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementPolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementPreferPrimaryDomainPolicy.__init__` has a new overload `def __init__(self: None, domain_name: str)` + - Method `ServicePlacementPreferPrimaryDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementPreferPrimaryDomainPolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementPreferPrimaryDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementRequireDomainDistributionPolicy.__init__` has a new overload `def __init__(self: None, domain_name: str)` + - Method `ServicePlacementRequireDomainDistributionPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementRequireDomainDistributionPolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementRequireDomainDistributionPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementRequiredDomainPolicy.__init__` has a new overload `def __init__(self: None, domain_name: str)` + - Method `ServicePlacementRequiredDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServicePlacementRequiredDomainPolicy.__init__` has a new overload `def __init__(self: None, type: str)` + - Method `ServicePlacementRequiredDomainPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceResource.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.ServiceResourceProperties], tags: Optional[Dict[str, str]], location: Optional[str])` + - Method `ServiceResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceResourceProperties.__init__` has a new overload `def __init__(self: None, service_kind: str, service_type_name: str, partition_description: _models.Partition, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]], service_package_activation_mode: Optional[Union[str, _models.ServicePackageActivationMode]], service_dns_name: Optional[str])` + - Method `ServiceResourceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceResourceProperties.__init__` has a new overload `def __init__(self: None, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]])` + - Method `ServiceResourceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceResourcePropertiesBase.__init__` has a new overload `def __init__(self: None, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]])` + - Method `ServiceResourcePropertiesBase.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceTypeHealthPolicy.__init__` has a new overload `def __init__(self: None, max_percent_unhealthy_services: int, max_percent_unhealthy_partitions_per_service: int, max_percent_unhealthy_replicas_per_partition: int)` + - Method `ServiceTypeHealthPolicy.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ServiceUpdateParameters.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]])` + - Method `ServiceUpdateParameters.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SettingsParameterDescription.__init__` has a new overload `def __init__(self: None, name: str, value: str)` + - Method `SettingsParameterDescription.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SettingsSectionDescription.__init__` has a new overload `def __init__(self: None, name: str, parameters: List[_models.SettingsParameterDescription])` + - Method `SettingsSectionDescription.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SingletonPartitionScheme.__init__` has a new overload `def __init__(self: None)` + - Method `SingletonPartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SingletonPartitionScheme.__init__` has a new overload `def __init__(self: None, partition_scheme: str)` + - Method `SingletonPartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Sku.__init__` has a new overload `def __init__(self: None, name: Union[str, _models.SkuName])` + - Method `Sku.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, service_type_name: str, partition_description: _models.Partition, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]], service_package_activation_mode: Optional[Union[str, _models.ServicePackageActivationMode]], service_dns_name: Optional[str], has_persisted_state: Optional[bool], target_replica_set_size: Optional[int], min_replica_set_size: Optional[int], replica_restart_wait_duration: Optional[str], quorum_loss_wait_duration: Optional[str], stand_by_replica_keep_duration: Optional[str], service_placement_time_limit: Optional[str])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, service_kind: str, service_type_name: str, partition_description: _models.Partition, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]], service_package_activation_mode: Optional[Union[str, _models.ServicePackageActivationMode]], service_dns_name: Optional[str])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]])` + - Method `StatefulServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, service_type_name: str, partition_description: _models.Partition, instance_count: int, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]], service_package_activation_mode: Optional[Union[str, _models.ServicePackageActivationMode]], service_dns_name: Optional[str], min_instance_count: Optional[int], min_instance_percentage: Optional[int])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, service_kind: str, service_type_name: str, partition_description: _models.Partition, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]], service_package_activation_mode: Optional[Union[str, _models.ServicePackageActivationMode]], service_dns_name: Optional[str])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, placement_constraints: Optional[str], correlation_scheme: Optional[List[_models.ServiceCorrelation]], service_load_metrics: Optional[List[_models.ServiceLoadMetric]], service_placement_policies: Optional[List[_models.ServicePlacementPolicy]], default_move_cost: Optional[Union[str, _models.MoveCost]], scaling_policies: Optional[List[_models.ScalingPolicy]])` + - Method `StatelessServiceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SubResource.__init__` has a new overload `def __init__(self: None, id: Optional[str])` + - Method `SubResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Subnet.__init__` has a new overload `def __init__(self: None, name: str, enable_ipv6: Optional[bool], private_endpoint_network_policies: Optional[Union[str, _models.PrivateEndpointNetworkPolicies]], private_link_service_network_policies: Optional[Union[str, _models.PrivateLinkServiceNetworkPolicies]], network_security_group_id: Optional[str])` + - Method `Subnet.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, created_by: Optional[str], created_by_type: Optional[Union[str, _models.CreatedByType]], created_at: Optional[datetime], last_modified_by: Optional[str], last_modified_by_type: Optional[Union[str, _models.CreatedByType]], last_modified_at: Optional[datetime])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `UniformInt64RangePartitionScheme.__init__` has a new overload `def __init__(self: None, count: int, low_key: int, high_key: int)` + - Method `UniformInt64RangePartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `UniformInt64RangePartitionScheme.__init__` has a new overload `def __init__(self: None, partition_scheme: str)` + - Method `UniformInt64RangePartitionScheme.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMSSExtension.__init__` has a new overload `def __init__(self: None, name: str, properties: _models.VMSSExtensionProperties)` + - Method `VMSSExtension.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultCertificate.__init__` has a new overload `def __init__(self: None, certificate_url: str, certificate_store: str)` + - Method `VaultCertificate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VaultSecretGroup.__init__` has a new overload `def __init__(self: None, source_vault: _models.SubResource, vault_certificates: List[_models.VaultCertificate])` + - Method `VaultSecretGroup.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VmApplication.__init__` has a new overload `def __init__(self: None, package_reference_id: str, configuration_reference: Optional[str], enable_automatic_upgrade: Optional[bool], order: Optional[int], vm_gallery_tags: Optional[str], treat_failure_as_deployment_failure: Optional[bool])` + - Method `VmApplication.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VmImagePlan.__init__` has a new overload `def __init__(self: None, name: Optional[str], product: Optional[str], promotion_code: Optional[str], publisher: Optional[str])` + - Method `VmImagePlan.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VmManagedIdentity.__init__` has a new overload `def __init__(self: None, user_assigned_identities: Optional[List[str]])` + - Method `VmManagedIdentity.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VmssDataDisk.__init__` has a new overload `def __init__(self: None, lun: int, disk_size_gb: int, disk_type: Union[str, _models.DiskType], disk_letter: str)` + - Method `VmssDataDisk.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationResourceProperties.__init__` has a new overload `def __init__(self: None, version: Optional[str], parameters: Optional[Dict[str, str]], upgrade_policy: Optional[_models.ApplicationUpgradePolicy], managed_identities: Optional[List[_models.ApplicationUserAssignedIdentity]])` + - Method `ApplicationResourceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeVersionResourceProperties.__init__` has a new overload `def __init__(self: None, app_package_url: str)` + - Method `ApplicationTypeVersionResourceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, error: Optional[_models.ErrorDetail])` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulation.__init__` has a new overload `def __init__(self: None, simulation_id: Optional[str], status: Optional[Union[str, _models.FaultSimulationStatus]], start_time: Optional[datetime], end_time: Optional[datetime], details: Optional[_models.FaultSimulationDetails])` + - Method `FaultSimulation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulationConstraints.__init__` has a new overload `def __init__(self: None, expiration_time: Optional[datetime])` + - Method `FaultSimulationConstraints.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulationContent.__init__` has a new overload `def __init__(self: None, fault_kind: str, force: Optional[bool], constraints: Optional[_models.FaultSimulationConstraints])` + - Method `FaultSimulationContent.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulationContentWrapper.__init__` has a new overload `def __init__(self: None, parameters: _models.FaultSimulationContent)` + - Method `FaultSimulationContentWrapper.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulationDetails.__init__` has a new overload `def __init__(self: None, cluster_id: Optional[str], operation_id: Optional[str], node_type_fault_simulation: Optional[List[_models.NodeTypeFaultSimulation]], parameters: Optional[_models.FaultSimulationContent])` + - Method `FaultSimulationDetails.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `FaultSimulationIdContent.__init__` has a new overload `def __init__(self: None, simulation_id: str)` + - Method `FaultSimulationIdContent.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `IPConfigurationPublicIPAddressConfiguration.__init__` has a new overload `def __init__(self: None, name: str, ip_tags: Optional[List[_models.IpTag]], public_ip_address_version: Optional[Union[str, _models.PublicIPAddressVersion]])` + - Method `IPConfigurationPublicIPAddressConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedClusterProperties.__init__` has a new overload `def __init__(self: None, dns_name: str, admin_user_name: str, client_connection_port: Optional[int], http_gateway_connection_port: Optional[int], admin_password: Optional[str], load_balancing_rules: Optional[List[_models.LoadBalancingRule]], allow_rdp_access: Optional[bool], network_security_rules: Optional[List[_models.NetworkSecurityRule]], clients: Optional[List[_models.ClientCertificate]], azure_active_directory: Optional[_models.AzureActiveDirectory], fabric_settings: Optional[List[_models.SettingsSectionDescription]], cluster_code_version: Optional[str], cluster_upgrade_mode: Optional[Union[str, _models.ClusterUpgradeMode]], cluster_upgrade_cadence: Optional[Union[str, _models.ClusterUpgradeCadence]], addon_features: Optional[List[Union[str, _models.ManagedClusterAddOnFeature]]], enable_auto_os_upgrade: Optional[bool], zonal_resiliency: Optional[bool], application_type_versions_cleanup_policy: Optional[_models.ApplicationTypeVersionsCleanupPolicy], enable_ipv6: Optional[bool], subnet_id: Optional[str], ip_tags: Optional[List[_models.IpTag]], enable_service_public_ip: Optional[bool], auxiliary_subnets: Optional[List[_models.Subnet]], service_endpoints: Optional[List[_models.ServiceEndpoint]], zonal_update_mode: Optional[Union[str, _models.ZonalUpdateMode]], use_custom_vnet: Optional[bool], public_ip_prefix_id: Optional[str], public_i_pv6_prefix_id: Optional[str], ddos_protection_plan_id: Optional[str], upgrade_description: Optional[_models.ClusterUpgradePolicy], http_gateway_token_auth_connection_port: Optional[int], enable_http_gateway_exclusive_auth_mode: Optional[bool], auto_generated_domain_name_label_scope: Optional[Union[str, _models.AutoGeneratedDomainNameLabelScope]], allocated_outbound_ports: Optional[int], vm_image: Optional[str])` + - Method `ManagedClusterProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ManagedClusterVersionDetails.__init__` has a new overload `def __init__(self: None, cluster_code_version: Optional[str], support_expiry_utc: Optional[datetime], os_type: Optional[Union[str, _models.OsType]])` + - Method `ManagedClusterVersionDetails.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeFaultSimulation.__init__` has a new overload `def __init__(self: None, node_type_name: Optional[str], status: Optional[Union[str, _models.FaultSimulationStatus]], operation_id: Optional[str], operation_status: Optional[Union[str, _models.SfmcOperationStatus]])` + - Method `NodeTypeFaultSimulation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NodeTypeProperties.__init__` has a new overload `def __init__(self: None, is_primary: bool, vm_instance_count: int, data_disk_size_gb: Optional[int], data_disk_type: Optional[Union[str, _models.DiskType]], data_disk_letter: Optional[str], placement_properties: Optional[Dict[str, str]], capacities: Optional[Dict[str, str]], application_ports: Optional[_models.EndpointRangeDescription], ephemeral_ports: Optional[_models.EndpointRangeDescription], vm_size: Optional[str], vm_image_publisher: Optional[str], vm_image_offer: Optional[str], vm_image_sku: Optional[str], vm_image_version: Optional[str], vm_secrets: Optional[List[_models.VaultSecretGroup]], vm_extensions: Optional[List[_models.VMSSExtension]], vm_managed_identity: Optional[_models.VmManagedIdentity], is_stateless: Optional[bool], multiple_placement_groups: Optional[bool], frontend_configurations: Optional[List[_models.FrontendConfiguration]], network_security_rules: Optional[List[_models.NetworkSecurityRule]], additional_data_disks: Optional[List[_models.VmssDataDisk]], enable_encryption_at_host: Optional[bool], enable_accelerated_networking: Optional[bool], use_default_public_load_balancer: Optional[bool], use_temp_data_disk: Optional[bool], enable_over_provisioning: Optional[bool], zones: Optional[List[str]], is_spot_vm: Optional[bool], host_group_id: Optional[str], use_ephemeral_os_disk: Optional[bool], spot_restore_timeout: Optional[str], eviction_policy: Optional[Union[str, _models.EvictionPolicyType]], vm_image_resource_id: Optional[str], subnet_id: Optional[str], vm_setup_actions: Optional[List[Union[str, _models.VmSetupAction]]], security_type: Optional[Union[str, _models.SecurityType]], security_encryption_type: Optional[Union[str, _models.SecurityEncryptionType]], secure_boot_enabled: Optional[bool], enable_node_public_ip: Optional[bool], enable_node_public_i_pv6: Optional[bool], vm_shared_gallery_image_id: Optional[str], nat_gateway_id: Optional[str], nat_configurations: Optional[List[_models.NodeTypeNatConfig]], vm_image_plan: Optional[_models.VmImagePlan], service_artifact_reference_id: Optional[str], dscp_configuration_id: Optional[str], additional_network_interface_configurations: Optional[List[_models.AdditionalNetworkInterfaceConfiguration]], computer_name_prefix: Optional[str], vm_applications: Optional[List[_models.VmApplication]], zone_balance: Optional[bool])` + - Method `NodeTypeProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `VMSSExtensionProperties.__init__` has a new overload `def __init__(self: None, publisher: str, type: str, type_handler_version: str, auto_upgrade_minor_version: Optional[bool], settings: Optional[Any], protected_settings: Optional[Any], force_update_tag: Optional[str], provision_after_extensions: Optional[List[str]], enable_automatic_upgrade: Optional[bool], setup_order: Optional[List[Union[str, _models.VmssExtensionSetupOrder]]])` + - Method `VMSSExtensionProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ZoneFaultSimulationContent.__init__` has a new overload `def __init__(self: None, force: Optional[bool], constraints: Optional[_models.FaultSimulationConstraints], zones: Optional[List[str]])` + - Method `ZoneFaultSimulationContent.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ZoneFaultSimulationContent.__init__` has a new overload `def __init__(self: None, fault_kind: str, force: Optional[bool], constraints: Optional[_models.FaultSimulationConstraints])` + - Method `ZoneFaultSimulationContent.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ApplicationTypeVersionsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, parameters: JSON, content_type: str)` + - Method `ApplicationTypeVersionsOperations.update` has a new overload `def update(self: None, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, parameters: JSON, content_type: str)` + - Method `ApplicationTypesOperations.create_or_update` has a new overload `def create_or_update(self: None, resource_group_name: str, cluster_name: str, application_type_name: str, parameters: JSON, content_type: str)` + - Method `ApplicationTypesOperations.update` has a new overload `def update(self: None, resource_group_name: str, cluster_name: str, application_type_name: str, parameters: JSON, content_type: str)` + - Method `ApplicationsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, cluster_name: str, application_name: str, parameters: JSON, content_type: str)` + - Method `ApplicationsOperations.begin_resume_upgrade` has a new overload `def begin_resume_upgrade(self: None, resource_group_name: str, cluster_name: str, application_name: str, parameters: JSON, content_type: str)` + - Method `ApplicationsOperations.update` has a new overload `def update(self: None, resource_group_name: str, cluster_name: str, application_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, cluster_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.update` has a new overload `def update(self: None, resource_group_name: str, cluster_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: FaultSimulationContentWrapper, content_type: str)` + - Method `ManagedClustersOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: IO[bytes], content_type: str)` + - Method `ManagedClustersOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: FaultSimulationIdContent, content_type: str)` + - Method `ManagedClustersOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: IO[bytes], content_type: str)` + - Method `ManagedClustersOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: FaultSimulationIdContent, content_type: str)` + - Method `ManagedClustersOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: JSON, content_type: str)` + - Method `ManagedClustersOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_delete_node` has a new overload `def begin_delete_node(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_reimage` has a new overload `def begin_reimage(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_restart` has a new overload `def begin_restart(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_deallocate` has a new overload `def begin_deallocate(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: NodeTypeActionParameters, content_type: str)` + - Method `NodeTypesOperations.begin_deallocate` has a new overload `def begin_deallocate(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_deallocate` has a new overload `def begin_deallocate(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.begin_redeploy` has a new overload `def begin_redeploy(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: NodeTypeActionParameters, content_type: str)` + - Method `NodeTypesOperations.begin_redeploy` has a new overload `def begin_redeploy(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_redeploy` has a new overload `def begin_redeploy(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.begin_start` has a new overload `def begin_start(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: NodeTypeActionParameters, content_type: str)` + - Method `NodeTypesOperations.begin_start` has a new overload `def begin_start(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_start` has a new overload `def begin_start(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: FaultSimulationContentWrapper, content_type: str)` + - Method `NodeTypesOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_start_fault_simulation` has a new overload `def begin_start_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: FaultSimulationIdContent, content_type: str)` + - Method `NodeTypesOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.begin_stop_fault_simulation` has a new overload `def begin_stop_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `NodeTypesOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: FaultSimulationIdContent, content_type: str)` + - Method `NodeTypesOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: JSON, content_type: str)` + - Method `NodeTypesOperations.get_fault_simulation` has a new overload `def get_fault_simulation(self: None, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: IO[bytes], content_type: str)` + - Method `ServicesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, parameters: JSON, content_type: str)` + - Method `ServicesOperations.update` has a new overload `def update(self: None, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, parameters: JSON, content_type: str)` + +### Breaking Changes + + - Model `AddRemoveIncrementalNamedPartitionScalingMechanism` deleted or renamed its instance variable `additional_properties` + - Model `AdditionalNetworkInterfaceConfiguration` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationHealthPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationResource` deleted or renamed its instance variable `provisioning_state` + - Model `ApplicationResource` deleted or renamed its instance variable `version` + - Model `ApplicationResource` deleted or renamed its instance variable `parameters` + - Model `ApplicationResource` deleted or renamed its instance variable `upgrade_policy` + - Model `ApplicationResource` deleted or renamed its instance variable `managed_identities` + - Model `ApplicationResource` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationTypeResource` deleted or renamed its instance variable `provisioning_state` + - Model `ApplicationTypeResource` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationTypeUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationTypeVersionResource` deleted or renamed its instance variable `provisioning_state` + - Model `ApplicationTypeVersionResource` deleted or renamed its instance variable `app_package_url` + - Model `ApplicationTypeVersionResource` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationTypeVersionUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationTypeVersionsCleanupPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationUpgradePolicy` deleted or renamed its instance variable `additional_properties` + - Model `ApplicationUserAssignedIdentity` deleted or renamed its instance variable `additional_properties` + - Model `AvailableOperationDisplay` deleted or renamed its instance variable `additional_properties` + - Model `AveragePartitionLoadScalingTrigger` deleted or renamed its instance variable `additional_properties` + - Model `AverageServiceLoadScalingTrigger` deleted or renamed its instance variable `additional_properties` + - Model `AzureActiveDirectory` deleted or renamed its instance variable `additional_properties` + - Model `ClientCertificate` deleted or renamed its instance variable `additional_properties` + - Model `ClusterHealthPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ClusterMonitoringPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ClusterUpgradeDeltaHealthPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ClusterUpgradePolicy` deleted or renamed its instance variable `additional_properties` + - Model `EndpointRangeDescription` deleted or renamed its instance variable `additional_properties` + - Model `ErrorModelError` deleted or renamed its instance variable `additional_properties` + - Model `FrontendConfiguration` deleted or renamed its instance variable `additional_properties` + - Model `IpConfiguration` deleted or renamed its instance variable `additional_properties` + - Model `IpTag` deleted or renamed its instance variable `additional_properties` + - Model `LoadBalancingRule` deleted or renamed its instance variable `additional_properties` + - Model `LongRunningOperationResult` deleted or renamed its instance variable `additional_properties` + - Model `ManagedAzResiliencyStatus` deleted or renamed its instance variable `additional_properties` + - Model `ManagedCluster` deleted or renamed its instance variable `dns_name` + - Model `ManagedCluster` deleted or renamed its instance variable `fqdn` + - Model `ManagedCluster` deleted or renamed its instance variable `ipv4_address` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_id` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_state` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_certificate_thumbprints` + - Model `ManagedCluster` deleted or renamed its instance variable `client_connection_port` + - Model `ManagedCluster` deleted or renamed its instance variable `http_gateway_connection_port` + - Model `ManagedCluster` deleted or renamed its instance variable `admin_user_name` + - Model `ManagedCluster` deleted or renamed its instance variable `admin_password` + - Model `ManagedCluster` deleted or renamed its instance variable `load_balancing_rules` + - Model `ManagedCluster` deleted or renamed its instance variable `allow_rdp_access` + - Model `ManagedCluster` deleted or renamed its instance variable `network_security_rules` + - Model `ManagedCluster` deleted or renamed its instance variable `clients` + - Model `ManagedCluster` deleted or renamed its instance variable `azure_active_directory` + - Model `ManagedCluster` deleted or renamed its instance variable `fabric_settings` + - Model `ManagedCluster` deleted or renamed its instance variable `provisioning_state` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_code_version` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_upgrade_mode` + - Model `ManagedCluster` deleted or renamed its instance variable `cluster_upgrade_cadence` + - Model `ManagedCluster` deleted or renamed its instance variable `addon_features` + - Model `ManagedCluster` deleted or renamed its instance variable `enable_auto_os_upgrade` + - Model `ManagedCluster` deleted or renamed its instance variable `zonal_resiliency` + - Model `ManagedCluster` deleted or renamed its instance variable `application_type_versions_cleanup_policy` + - Model `ManagedCluster` deleted or renamed its instance variable `enable_ipv6` + - Model `ManagedCluster` deleted or renamed its instance variable `subnet_id` + - Model `ManagedCluster` deleted or renamed its instance variable `ip_tags` + - Model `ManagedCluster` deleted or renamed its instance variable `ipv6_address` + - Model `ManagedCluster` deleted or renamed its instance variable `enable_service_public_ip` + - Model `ManagedCluster` deleted or renamed its instance variable `auxiliary_subnets` + - Model `ManagedCluster` deleted or renamed its instance variable `service_endpoints` + - Model `ManagedCluster` deleted or renamed its instance variable `zonal_update_mode` + - Model `ManagedCluster` deleted or renamed its instance variable `use_custom_vnet` + - Model `ManagedCluster` deleted or renamed its instance variable `public_ip_prefix_id` + - Model `ManagedCluster` deleted or renamed its instance variable `public_i_pv6_prefix_id` + - Model `ManagedCluster` deleted or renamed its instance variable `ddos_protection_plan_id` + - Model `ManagedCluster` deleted or renamed its instance variable `upgrade_description` + - Model `ManagedCluster` deleted or renamed its instance variable `http_gateway_token_auth_connection_port` + - Model `ManagedCluster` deleted or renamed its instance variable `enable_http_gateway_exclusive_auth_mode` + - Model `ManagedCluster` deleted or renamed its instance variable `auto_generated_domain_name_label_scope` + - Model `ManagedCluster` deleted or renamed its instance variable `allocated_outbound_ports` + - Model `ManagedCluster` deleted or renamed its instance variable `additional_properties` + - Model `ManagedClusterCodeVersionResult` deleted or renamed its instance variable `cluster_code_version` + - Model `ManagedClusterCodeVersionResult` deleted or renamed its instance variable `support_expiry_utc` + - Model `ManagedClusterCodeVersionResult` deleted or renamed its instance variable `os_type` + - Model `ManagedClusterCodeVersionResult` deleted or renamed its instance variable `additional_properties` + - Model `ManagedClusterUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `ManagedIdentity` deleted or renamed its instance variable `additional_properties` + - Model `ManagedMaintenanceWindowStatus` deleted or renamed its instance variable `additional_properties` + - Model `ManagedVMSize` deleted or renamed its instance variable `additional_properties` + - Model `NamedPartitionScheme` deleted or renamed its instance variable `additional_properties` + - Model `NetworkSecurityRule` deleted or renamed its instance variable `additional_properties` + - Model `NodeType` deleted or renamed its instance variable `is_primary` + - Model `NodeType` deleted or renamed its instance variable `vm_instance_count` + - Model `NodeType` deleted or renamed its instance variable `data_disk_size_gb` + - Model `NodeType` deleted or renamed its instance variable `data_disk_type` + - Model `NodeType` deleted or renamed its instance variable `data_disk_letter` + - Model `NodeType` deleted or renamed its instance variable `placement_properties` + - Model `NodeType` deleted or renamed its instance variable `capacities` + - Model `NodeType` deleted or renamed its instance variable `application_ports` + - Model `NodeType` deleted or renamed its instance variable `ephemeral_ports` + - Model `NodeType` deleted or renamed its instance variable `vm_size` + - Model `NodeType` deleted or renamed its instance variable `vm_image_publisher` + - Model `NodeType` deleted or renamed its instance variable `vm_image_offer` + - Model `NodeType` deleted or renamed its instance variable `vm_image_sku` + - Model `NodeType` deleted or renamed its instance variable `vm_image_version` + - Model `NodeType` deleted or renamed its instance variable `vm_secrets` + - Model `NodeType` deleted or renamed its instance variable `vm_extensions` + - Model `NodeType` deleted or renamed its instance variable `vm_managed_identity` + - Model `NodeType` deleted or renamed its instance variable `is_stateless` + - Model `NodeType` deleted or renamed its instance variable `multiple_placement_groups` + - Model `NodeType` deleted or renamed its instance variable `frontend_configurations` + - Model `NodeType` deleted or renamed its instance variable `network_security_rules` + - Model `NodeType` deleted or renamed its instance variable `additional_data_disks` + - Model `NodeType` deleted or renamed its instance variable `enable_encryption_at_host` + - Model `NodeType` deleted or renamed its instance variable `provisioning_state` + - Model `NodeType` deleted or renamed its instance variable `enable_accelerated_networking` + - Model `NodeType` deleted or renamed its instance variable `use_default_public_load_balancer` + - Model `NodeType` deleted or renamed its instance variable `use_temp_data_disk` + - Model `NodeType` deleted or renamed its instance variable `enable_over_provisioning` + - Model `NodeType` deleted or renamed its instance variable `zones` + - Model `NodeType` deleted or renamed its instance variable `is_spot_vm` + - Model `NodeType` deleted or renamed its instance variable `host_group_id` + - Model `NodeType` deleted or renamed its instance variable `use_ephemeral_os_disk` + - Model `NodeType` deleted or renamed its instance variable `spot_restore_timeout` + - Model `NodeType` deleted or renamed its instance variable `eviction_policy` + - Model `NodeType` deleted or renamed its instance variable `vm_image_resource_id` + - Model `NodeType` deleted or renamed its instance variable `subnet_id` + - Model `NodeType` deleted or renamed its instance variable `vm_setup_actions` + - Model `NodeType` deleted or renamed its instance variable `security_type` + - Model `NodeType` deleted or renamed its instance variable `secure_boot_enabled` + - Model `NodeType` deleted or renamed its instance variable `enable_node_public_ip` + - Model `NodeType` deleted or renamed its instance variable `enable_node_public_i_pv6` + - Model `NodeType` deleted or renamed its instance variable `vm_shared_gallery_image_id` + - Model `NodeType` deleted or renamed its instance variable `nat_gateway_id` + - Model `NodeType` deleted or renamed its instance variable `nat_configurations` + - Model `NodeType` deleted or renamed its instance variable `vm_image_plan` + - Model `NodeType` deleted or renamed its instance variable `service_artifact_reference_id` + - Model `NodeType` deleted or renamed its instance variable `dscp_configuration_id` + - Model `NodeType` deleted or renamed its instance variable `additional_network_interface_configurations` + - Model `NodeType` deleted or renamed its instance variable `computer_name_prefix` + - Model `NodeType` deleted or renamed its instance variable `vm_applications` + - Model `NodeType` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeActionParameters` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeAvailableSku` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeNatConfig` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeSku` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeSkuCapacity` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeSupportedSku` deleted or renamed its instance variable `additional_properties` + - Model `NodeTypeUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `OperationResult` deleted or renamed its instance variable `additional_properties` + - Model `Partition` deleted or renamed its instance variable `additional_properties` + - Model `PartitionInstanceCountScaleMechanism` deleted or renamed its instance variable `additional_properties` + - Model `ProxyResource` deleted or renamed its instance variable `location` + - Model `ProxyResource` deleted or renamed its instance variable `tags` + - Model `ProxyResource` deleted or renamed its instance variable `additional_properties` + - Model `Resource` deleted or renamed its instance variable `location` + - Model `Resource` deleted or renamed its instance variable `tags` + - Model `Resource` deleted or renamed its instance variable `etag` + - Model `Resource` deleted or renamed its instance variable `additional_properties` + - Model `ResourceAzStatus` deleted or renamed its instance variable `additional_properties` + - Model `RollingUpgradeMonitoringPolicy` deleted or renamed its instance variable `additional_properties` + - Model `RuntimeResumeApplicationUpgradeParameters` deleted or renamed its instance variable `additional_properties` + - Model `ScalingMechanism` deleted or renamed its instance variable `additional_properties` + - Model `ScalingPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ScalingTrigger` deleted or renamed its instance variable `additional_properties` + - Model `ServiceCorrelation` deleted or renamed its instance variable `additional_properties` + - Model `ServiceEndpoint` deleted or renamed its instance variable `additional_properties` + - Model `ServiceLoadMetric` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementInvalidDomainPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementNonPartiallyPlaceServicePolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementPreferPrimaryDomainPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementRequireDomainDistributionPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServicePlacementRequiredDomainPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServiceResource` deleted or renamed its instance variable `additional_properties` + - Model `ServiceResourceProperties` deleted or renamed its instance variable `additional_properties` + - Model `ServiceResourcePropertiesBase` deleted or renamed its instance variable `additional_properties` + - Model `ServiceTypeHealthPolicy` deleted or renamed its instance variable `additional_properties` + - Model `ServiceUpdateParameters` deleted or renamed its instance variable `additional_properties` + - Model `SettingsParameterDescription` deleted or renamed its instance variable `additional_properties` + - Model `SettingsSectionDescription` deleted or renamed its instance variable `additional_properties` + - Model `SingletonPartitionScheme` deleted or renamed its instance variable `additional_properties` + - Model `Sku` deleted or renamed its instance variable `additional_properties` + - Model `StatefulServiceProperties` deleted or renamed its instance variable `additional_properties` + - Model `StatelessServiceProperties` deleted or renamed its instance variable `additional_properties` + - Model `SubResource` deleted or renamed its instance variable `additional_properties` + - Model `Subnet` deleted or renamed its instance variable `additional_properties` + - Model `SystemData` deleted or renamed its instance variable `additional_properties` + - Model `UniformInt64RangePartitionScheme` deleted or renamed its instance variable `additional_properties` + - Model `UserAssignedIdentity` deleted or renamed its instance variable `additional_properties` + - Model `VMSSExtension` deleted or renamed its instance variable `publisher` + - Model `VMSSExtension` deleted or renamed its instance variable `type` + - Model `VMSSExtension` deleted or renamed its instance variable `type_handler_version` + - Model `VMSSExtension` deleted or renamed its instance variable `auto_upgrade_minor_version` + - Model `VMSSExtension` deleted or renamed its instance variable `settings` + - Model `VMSSExtension` deleted or renamed its instance variable `protected_settings` + - Model `VMSSExtension` deleted or renamed its instance variable `force_update_tag` + - Model `VMSSExtension` deleted or renamed its instance variable `provision_after_extensions` + - Model `VMSSExtension` deleted or renamed its instance variable `provisioning_state` + - Model `VMSSExtension` deleted or renamed its instance variable `enable_automatic_upgrade` + - Model `VMSSExtension` deleted or renamed its instance variable `setup_order` + - Model `VMSSExtension` deleted or renamed its instance variable `additional_properties` + - Model `VMSize` deleted or renamed its instance variable `additional_properties` + - Model `VaultCertificate` deleted or renamed its instance variable `additional_properties` + - Model `VaultSecretGroup` deleted or renamed its instance variable `additional_properties` + - Model `VmApplication` deleted or renamed its instance variable `additional_properties` + - Model `VmImagePlan` deleted or renamed its instance variable `additional_properties` + - Model `VmManagedIdentity` deleted or renamed its instance variable `additional_properties` + - Model `VmssDataDisk` deleted or renamed its instance variable `additional_properties` + - Deleted or renamed model `ApplicationResourceList` + - Deleted or renamed model `ApplicationTypeResourceList` + - Deleted or renamed model `ApplicationTypeVersionResourceList` + - Deleted or renamed model `ErrorModel` + - Deleted or renamed model `IpConfigurationPublicIPAddressConfiguration` + - Deleted or renamed model `ManagedProxyResource` + - Deleted or renamed model `ManagedVMSizesResult` + - Deleted or renamed model `NodeTypeListSkuResult` + - Deleted or renamed model `ServiceResourceList` + - Deleted or renamed model `UpgradeMode` + - Deleted or renamed method `OperationResultsOperations.get` + ## 2.1.0b2 (2024-12-16) ### Features Added diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md index 85ddf426219e..ad6b3f465737 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md @@ -1,7 +1,7 @@ # Microsoft Azure SDK for Python This is the Microsoft Azure Service Fabric Managed Clusters Management Client Library. -This package has been tested with Python 3.8+. +This package has been tested with Python 3.9+. 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.8+ is required to use this package. +- Python 3.9+ 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 configure of following environment variables. +By default, [Azure Active Directory](https://aka.ms/awps/aad) 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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json index 3d5891b0485c..43359b26a86e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json @@ -1,11 +1,6 @@ { - "commit": "93a8154cfee7eb198397e256357fa60dce671763", + "commit": "b9a8c9e8eb8998a222f126a005d1ab633f1daad9", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.26.4", - "@autorest/modelerfour@4.27.0" - ], - "autorest_command": "autorest specification/servicefabricmanagedclusters/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.26.4 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", - "readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md" + "typespec_src": "specification/servicefabricmanagedclusters/ServiceFabricManagedClusters.Management", + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/apiview-properties.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/apiview-properties.json new file mode 100644 index 000000000000..feec5b0f7d2b --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/apiview-properties.json @@ -0,0 +1,280 @@ +{ + "CrossLanguagePackageId": "Microsoft.ServiceFabric", + "CrossLanguageDefinitionId": { + "azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration": "Microsoft.ServiceFabric.AdditionalNetworkInterfaceConfiguration", + "azure.mgmt.servicefabricmanagedclusters.models.ScalingMechanism": "Microsoft.ServiceFabric.ScalingMechanism", + "azure.mgmt.servicefabricmanagedclusters.models.AddRemoveIncrementalNamedPartitionScalingMechanism": "Microsoft.ServiceFabric.AddRemoveIncrementalNamedPartitionScalingMechanism", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationHealthPolicy": "Microsoft.ServiceFabric.ApplicationHealthPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.servicefabricmanagedclusters.models.ProxyResource": "Azure.ResourceManager.CommonTypes.ProxyResource", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource": "Microsoft.ServiceFabric.ApplicationResource", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationResourceProperties": "Microsoft.ServiceFabric.ApplicationResourceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource": "Microsoft.ServiceFabric.ApplicationTypeResource", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResourceProperties": "Microsoft.ServiceFabric.ApplicationTypeResourceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters": "Microsoft.ServiceFabric.ApplicationTypeUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource": "Microsoft.ServiceFabric.ApplicationTypeVersionResource", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResourceProperties": "Microsoft.ServiceFabric.ApplicationTypeVersionResourceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionsCleanupPolicy": "Microsoft.ServiceFabric.ApplicationTypeVersionsCleanupPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters": "Microsoft.ServiceFabric.ApplicationTypeVersionUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters": "Microsoft.ServiceFabric.ApplicationUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpgradePolicy": "Microsoft.ServiceFabric.ApplicationUpgradePolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ApplicationUserAssignedIdentity": "Microsoft.ServiceFabric.ApplicationUserAssignedIdentity", + "azure.mgmt.servicefabricmanagedclusters.models.AvailableOperationDisplay": "Microsoft.ServiceFabric.AvailableOperationDisplay", + "azure.mgmt.servicefabricmanagedclusters.models.ScalingTrigger": "Microsoft.ServiceFabric.ScalingTrigger", + "azure.mgmt.servicefabricmanagedclusters.models.AveragePartitionLoadScalingTrigger": "Microsoft.ServiceFabric.AveragePartitionLoadScalingTrigger", + "azure.mgmt.servicefabricmanagedclusters.models.AverageServiceLoadScalingTrigger": "Microsoft.ServiceFabric.AverageServiceLoadScalingTrigger", + "azure.mgmt.servicefabricmanagedclusters.models.AzureActiveDirectory": "Microsoft.ServiceFabric.AzureActiveDirectory", + "azure.mgmt.servicefabricmanagedclusters.models.ClientCertificate": "Microsoft.ServiceFabric.ClientCertificate", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy": "Microsoft.ServiceFabric.ClusterHealthPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy": "Microsoft.ServiceFabric.ClusterMonitoringPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy": "Microsoft.ServiceFabric.ClusterUpgradeDeltaHealthPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy": "Microsoft.ServiceFabric.ClusterUpgradePolicy", + "azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription": "Microsoft.ServiceFabric.EndpointRangeDescription", + "azure.mgmt.servicefabricmanagedclusters.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.servicefabricmanagedclusters.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError": "Microsoft.ServiceFabric.ErrorModelError", + "azure.mgmt.servicefabricmanagedclusters.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation": "Microsoft.ServiceFabric.FaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationConstraints": "Microsoft.ServiceFabric.FaultSimulationConstraints", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContent": "Microsoft.ServiceFabric.FaultSimulationContent", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper": "Microsoft.ServiceFabric.FaultSimulationContentWrapper", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationDetails": "Microsoft.ServiceFabric.FaultSimulationDetails", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent": "Microsoft.ServiceFabric.FaultSimulationIdContent", + "azure.mgmt.servicefabricmanagedclusters.models.FrontendConfiguration": "Microsoft.ServiceFabric.FrontendConfiguration", + "azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration": "Microsoft.ServiceFabric.IpConfiguration", + "azure.mgmt.servicefabricmanagedclusters.models.IPConfigurationPublicIPAddressConfiguration": "Microsoft.ServiceFabric.PublicIPAddressConfiguration", + "azure.mgmt.servicefabricmanagedclusters.models.IpTag": "Microsoft.ServiceFabric.IpTag", + "azure.mgmt.servicefabricmanagedclusters.models.LoadBalancingRule": "Microsoft.ServiceFabric.LoadBalancingRule", + "azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult": "Microsoft.ServiceFabric.LongRunningOperationResult", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus": "Microsoft.ServiceFabric.ManagedAzResiliencyStatusContent", + "azure.mgmt.servicefabricmanagedclusters.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster": "Microsoft.ServiceFabric.ManagedCluster", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult": "Microsoft.ServiceFabric.ManagedClusterCodeVersionResult", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterProperties": "Microsoft.ServiceFabric.ManagedClusterProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters": "Microsoft.ServiceFabric.ManagedClusterUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionDetails": "Microsoft.ServiceFabric.ManagedClusterVersionDetails", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentity": "Microsoft.ServiceFabric.ManagedIdentity", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus": "Microsoft.ServiceFabric.ManagedMaintenanceWindowStatusContent", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize": "Microsoft.ServiceFabric.ManagedVMSize", + "azure.mgmt.servicefabricmanagedclusters.models.Partition": "Microsoft.ServiceFabric.Partition", + "azure.mgmt.servicefabricmanagedclusters.models.NamedPartitionScheme": "Microsoft.ServiceFabric.NamedPartitionScheme", + "azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule": "Microsoft.ServiceFabric.NetworkSecurityRule", + "azure.mgmt.servicefabricmanagedclusters.models.NodeType": "Microsoft.ServiceFabric.NodeType", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters": "Microsoft.ServiceFabric.NodeTypeActionParameters", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku": "Microsoft.ServiceFabric.NodeTypeAvailableSku", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeFaultSimulation": "Microsoft.ServiceFabric.NodeTypeFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeNatConfig": "Microsoft.ServiceFabric.NodeTypeNatConfig", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeProperties": "Microsoft.ServiceFabric.NodeTypeProperties", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku": "Microsoft.ServiceFabric.NodeTypeSku", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuCapacity": "Microsoft.ServiceFabric.NodeTypeSkuCapacity", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSupportedSku": "Microsoft.ServiceFabric.NodeTypeSupportedSku", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters": "Microsoft.ServiceFabric.NodeTypeUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.OperationResult": "Microsoft.ServiceFabric.OperationResult", + "azure.mgmt.servicefabricmanagedclusters.models.PartitionInstanceCountScaleMechanism": "Microsoft.ServiceFabric.PartitionInstanceCountScaleMechanism", + "azure.mgmt.servicefabricmanagedclusters.models.ResourceAzStatus": "Microsoft.ServiceFabric.ResourceAzStatus", + "azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMonitoringPolicy": "Microsoft.ServiceFabric.RollingUpgradeMonitoringPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters": "Microsoft.ServiceFabric.RuntimeResumeApplicationUpgradeParameters", + "azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy": "Microsoft.ServiceFabric.ScalingPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation": "Microsoft.ServiceFabric.ServiceCorrelation", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceEndpoint": "Microsoft.ServiceFabric.ServiceEndpoint", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric": "Microsoft.ServiceFabric.ServiceLoadMetric", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy": "Microsoft.ServiceFabric.ServicePlacementPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementInvalidDomainPolicy": "Microsoft.ServiceFabric.ServicePlacementInvalidDomainPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementNonPartiallyPlaceServicePolicy": "Microsoft.ServiceFabric.ServicePlacementNonPartiallyPlaceServicePolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPreferPrimaryDomainPolicy": "Microsoft.ServiceFabric.ServicePlacementPreferPrimaryDomainPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementRequiredDomainPolicy": "Microsoft.ServiceFabric.ServicePlacementRequiredDomainPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementRequireDomainDistributionPolicy": "Microsoft.ServiceFabric.ServicePlacementRequireDomainDistributionPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceResource": "Microsoft.ServiceFabric.ServiceResource", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceResourcePropertiesBase": "Microsoft.ServiceFabric.ServiceResourcePropertiesBase", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceProperties": "Microsoft.ServiceFabric.ServiceResourceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy": "Microsoft.ServiceFabric.ServiceTypeHealthPolicy", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters": "Microsoft.ServiceFabric.ServiceUpdateParameters", + "azure.mgmt.servicefabricmanagedclusters.models.SettingsParameterDescription": "Microsoft.ServiceFabric.SettingsParameterDescription", + "azure.mgmt.servicefabricmanagedclusters.models.SettingsSectionDescription": "Microsoft.ServiceFabric.SettingsSectionDescription", + "azure.mgmt.servicefabricmanagedclusters.models.SingletonPartitionScheme": "Microsoft.ServiceFabric.SingletonPartitionScheme", + "azure.mgmt.servicefabricmanagedclusters.models.Sku": "Microsoft.ServiceFabric.Sku", + "azure.mgmt.servicefabricmanagedclusters.models.StatefulServiceProperties": "Microsoft.ServiceFabric.StatefulServiceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.StatelessServiceProperties": "Microsoft.ServiceFabric.StatelessServiceProperties", + "azure.mgmt.servicefabricmanagedclusters.models.Subnet": "Microsoft.ServiceFabric.Subnet", + "azure.mgmt.servicefabricmanagedclusters.models.SubResource": "Microsoft.ServiceFabric.SubResource", + "azure.mgmt.servicefabricmanagedclusters.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.servicefabricmanagedclusters.models.UniformInt64RangePartitionScheme": "Microsoft.ServiceFabric.UniformInt64RangePartitionScheme", + "azure.mgmt.servicefabricmanagedclusters.models.UserAssignedIdentity": "Microsoft.ServiceFabric.UserAssignedIdentity", + "azure.mgmt.servicefabricmanagedclusters.models.VaultCertificate": "Microsoft.ServiceFabric.VaultCertificate", + "azure.mgmt.servicefabricmanagedclusters.models.VaultSecretGroup": "Microsoft.ServiceFabric.VaultSecretGroup", + "azure.mgmt.servicefabricmanagedclusters.models.VmApplication": "Microsoft.ServiceFabric.VmApplication", + "azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan": "Microsoft.ServiceFabric.VmImagePlan", + "azure.mgmt.servicefabricmanagedclusters.models.VmManagedIdentity": "Microsoft.ServiceFabric.VmManagedIdentity", + "azure.mgmt.servicefabricmanagedclusters.models.VMSize": "Microsoft.ServiceFabric.VMSize", + "azure.mgmt.servicefabricmanagedclusters.models.VmssDataDisk": "Microsoft.ServiceFabric.VmssDataDisk", + "azure.mgmt.servicefabricmanagedclusters.models.VMSSExtension": "Microsoft.ServiceFabric.VMSSExtension", + "azure.mgmt.servicefabricmanagedclusters.models.VMSSExtensionProperties": "Microsoft.ServiceFabric.VMSSExtensionProperties", + "azure.mgmt.servicefabricmanagedclusters.models.ZoneFaultSimulationContent": "Microsoft.ServiceFabric.ZoneFaultSimulationContent", + "azure.mgmt.servicefabricmanagedclusters.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.servicefabricmanagedclusters.models.FailureAction": "Microsoft.ServiceFabric.FailureAction", + "azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode": "Microsoft.ServiceFabric.RollingUpgradeMode", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType": "Microsoft.ServiceFabric.ManagedIdentityType", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme": "Microsoft.ServiceFabric.ServiceCorrelationScheme", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight": "Microsoft.ServiceFabric.ServiceLoadMetricWeight", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType": "Microsoft.ServiceFabric.ServicePlacementPolicyType", + "azure.mgmt.servicefabricmanagedclusters.models.MoveCost": "Microsoft.ServiceFabric.MoveCost", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind": "Microsoft.ServiceFabric.ServiceScalingMechanismKind", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind": "Microsoft.ServiceFabric.ServiceScalingTriggerKind", + "azure.mgmt.servicefabricmanagedclusters.models.ServiceKind": "Microsoft.ServiceFabric.ServiceKind", + "azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme": "Microsoft.ServiceFabric.PartitionScheme", + "azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode": "Microsoft.ServiceFabric.ServicePackageActivationMode", + "azure.mgmt.servicefabricmanagedclusters.models.OsType": "Microsoft.ServiceFabric.OsType", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment": "Microsoft.ServiceFabric.ManagedClusterVersionEnvironment", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterState": "Microsoft.ServiceFabric.ClusterState", + "azure.mgmt.servicefabricmanagedclusters.models.Protocol": "Microsoft.ServiceFabric.Protocol", + "azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol": "Microsoft.ServiceFabric.ProbeProtocol", + "azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol": "Microsoft.ServiceFabric.NsgProtocol", + "azure.mgmt.servicefabricmanagedclusters.models.Access": "Microsoft.ServiceFabric.Access", + "azure.mgmt.servicefabricmanagedclusters.models.Direction": "Microsoft.ServiceFabric.Direction", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState": "Microsoft.ServiceFabric.ManagedResourceProvisioningState", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode": "Microsoft.ServiceFabric.ClusterUpgradeMode", + "azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence": "Microsoft.ServiceFabric.ClusterUpgradeCadence", + "azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterAddOnFeature": "Microsoft.ServiceFabric.ManagedClusterAddOnFeature", + "azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies": "Microsoft.ServiceFabric.PrivateEndpointNetworkPolicies", + "azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies": "Microsoft.ServiceFabric.PrivateLinkServiceNetworkPolicies", + "azure.mgmt.servicefabricmanagedclusters.models.ZonalUpdateMode": "Microsoft.ServiceFabric.ZonalUpdateMode", + "azure.mgmt.servicefabricmanagedclusters.models.AutoGeneratedDomainNameLabelScope": "Microsoft.ServiceFabric.AutoGeneratedDomainNameLabelScope", + "azure.mgmt.servicefabricmanagedclusters.models.SkuName": "Microsoft.ServiceFabric.SkuName", + "azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationStatus": "Microsoft.ServiceFabric.FaultSimulationStatus", + "azure.mgmt.servicefabricmanagedclusters.models.SfmcOperationStatus": "Microsoft.ServiceFabric.SfmcOperationStatus", + "azure.mgmt.servicefabricmanagedclusters.models.FaultKind": "Microsoft.ServiceFabric.FaultKind", + "azure.mgmt.servicefabricmanagedclusters.models.DiskType": "Microsoft.ServiceFabric.DiskType", + "azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder": "Microsoft.ServiceFabric.VmssExtensionSetupOrder", + "azure.mgmt.servicefabricmanagedclusters.models.IPAddressType": "Microsoft.ServiceFabric.IPAddressType", + "azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType": "Microsoft.ServiceFabric.EvictionPolicyType", + "azure.mgmt.servicefabricmanagedclusters.models.VmSetupAction": "Microsoft.ServiceFabric.VmSetupAction", + "azure.mgmt.servicefabricmanagedclusters.models.SecurityType": "Microsoft.ServiceFabric.SecurityType", + "azure.mgmt.servicefabricmanagedclusters.models.SecurityEncryptionType": "Microsoft.ServiceFabric.SecurityEncryptionType", + "azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion": "Microsoft.ServiceFabric.PrivateIPAddressVersion", + "azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion": "Microsoft.ServiceFabric.PublicIPAddressVersion", + "azure.mgmt.servicefabricmanagedclusters.models.UpdateType": "Microsoft.ServiceFabric.UpdateType", + "azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuScaleType": "Microsoft.ServiceFabric.NodeTypeSkuScaleType", + "azure.mgmt.servicefabricmanagedclusters.operations.Operations.list": "Microsoft.ServiceFabric.Operations.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.Operations.list": "Microsoft.ServiceFabric.Operations.list", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.get": "Microsoft.ServiceFabric.Applications.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.get": "Microsoft.ServiceFabric.Applications.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.begin_create_or_update": "Microsoft.ServiceFabric.Applications.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.begin_create_or_update": "Microsoft.ServiceFabric.Applications.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.update": "Microsoft.ServiceFabric.Applications.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.update": "Microsoft.ServiceFabric.Applications.update", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.begin_delete": "Microsoft.ServiceFabric.Applications.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.begin_delete": "Microsoft.ServiceFabric.Applications.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.list": "Microsoft.ServiceFabric.Applications.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.list": "Microsoft.ServiceFabric.Applications.list", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.begin_read_upgrade": "Microsoft.ServiceFabric.Applications.readUpgrade", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.begin_read_upgrade": "Microsoft.ServiceFabric.Applications.readUpgrade", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.begin_resume_upgrade": "Microsoft.ServiceFabric.Applications.resumeUpgrade", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.begin_resume_upgrade": "Microsoft.ServiceFabric.Applications.resumeUpgrade", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations.begin_start_rollback": "Microsoft.ServiceFabric.Applications.startRollback", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations.begin_start_rollback": "Microsoft.ServiceFabric.Applications.startRollback", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations.get": "Microsoft.ServiceFabric.ApplicationTypes.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations.get": "Microsoft.ServiceFabric.ApplicationTypes.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations.create_or_update": "Microsoft.ServiceFabric.ApplicationTypes.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations.create_or_update": "Microsoft.ServiceFabric.ApplicationTypes.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations.update": "Microsoft.ServiceFabric.ApplicationTypes.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations.update": "Microsoft.ServiceFabric.ApplicationTypes.update", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations.begin_delete": "Microsoft.ServiceFabric.ApplicationTypes.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations.begin_delete": "Microsoft.ServiceFabric.ApplicationTypes.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations.list": "Microsoft.ServiceFabric.ApplicationTypes.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations.list": "Microsoft.ServiceFabric.ApplicationTypes.list", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations.get": "Microsoft.ServiceFabric.ApplicationTypeVersions.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations.get": "Microsoft.ServiceFabric.ApplicationTypeVersions.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations.begin_create_or_update": "Microsoft.ServiceFabric.ApplicationTypeVersions.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations.begin_create_or_update": "Microsoft.ServiceFabric.ApplicationTypeVersions.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations.update": "Microsoft.ServiceFabric.ApplicationTypeVersions.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations.update": "Microsoft.ServiceFabric.ApplicationTypeVersions.update", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations.begin_delete": "Microsoft.ServiceFabric.ApplicationTypeVersions.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations.begin_delete": "Microsoft.ServiceFabric.ApplicationTypeVersions.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations.list_by_application_types": "Microsoft.ServiceFabric.ApplicationTypeVersions.listByApplicationTypes", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations.list_by_application_types": "Microsoft.ServiceFabric.ApplicationTypeVersions.listByApplicationTypes", + "azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations.get": "Microsoft.ServiceFabric.Services.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations.get": "Microsoft.ServiceFabric.Services.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations.begin_create_or_update": "Microsoft.ServiceFabric.Services.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations.begin_create_or_update": "Microsoft.ServiceFabric.Services.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations.update": "Microsoft.ServiceFabric.Services.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations.update": "Microsoft.ServiceFabric.Services.update", + "azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations.begin_delete": "Microsoft.ServiceFabric.Services.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations.begin_delete": "Microsoft.ServiceFabric.Services.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations.list_by_applications": "Microsoft.ServiceFabric.Services.listByApplications", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations.list_by_applications": "Microsoft.ServiceFabric.Services.listByApplications", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations.get": "Microsoft.ServiceFabric.ManagedClusterVersion.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations.get": "Microsoft.ServiceFabric.ManagedClusterVersion.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations.list": "Microsoft.ServiceFabric.ManagedClusterVersion.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations.list": "Microsoft.ServiceFabric.ManagedClusterVersion.list", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations.get_by_environment": "Microsoft.ServiceFabric.ManagedClusterVersion.getByEnvironment", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations.get_by_environment": "Microsoft.ServiceFabric.ManagedClusterVersion.getByEnvironment", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations.list_by_environment": "Microsoft.ServiceFabric.ManagedClusterVersion.listByEnvironment", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations.list_by_environment": "Microsoft.ServiceFabric.ManagedClusterVersion.listByEnvironment", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedUnsupportedVMSizesOperations.get": "Microsoft.ServiceFabric.ManagedUnsupportedVMSizes.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedUnsupportedVMSizesOperations.get": "Microsoft.ServiceFabric.ManagedUnsupportedVMSizes.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedUnsupportedVMSizesOperations.list": "Microsoft.ServiceFabric.ManagedUnsupportedVMSizes.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedUnsupportedVMSizesOperations.list": "Microsoft.ServiceFabric.ManagedUnsupportedVMSizes.list", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.get": "Microsoft.ServiceFabric.ManagedClusters.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.get": "Microsoft.ServiceFabric.ManagedClusters.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.begin_create_or_update": "Microsoft.ServiceFabric.ManagedClusters.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.begin_create_or_update": "Microsoft.ServiceFabric.ManagedClusters.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.update": "Microsoft.ServiceFabric.ManagedClusters.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.update": "Microsoft.ServiceFabric.ManagedClusters.update", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.begin_delete": "Microsoft.ServiceFabric.ManagedClusters.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.begin_delete": "Microsoft.ServiceFabric.ManagedClusters.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.list_by_resource_group": "Microsoft.ServiceFabric.ManagedClusters.listByResourceGroup", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.list_by_resource_group": "Microsoft.ServiceFabric.ManagedClusters.listByResourceGroup", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.list_by_subscription": "Microsoft.ServiceFabric.ManagedClusters.listBySubscription", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.list_by_subscription": "Microsoft.ServiceFabric.ManagedClusters.listBySubscription", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.get_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.getFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.get_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.getFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.list_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.listFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.list_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.listFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.begin_start_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.startFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.begin_start_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.startFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations.begin_stop_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.stopFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations.begin_stop_fault_simulation": "Microsoft.ServiceFabric.ManagedClusters.stopFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedAzResiliencyStatusOperations.get": "Microsoft.ServiceFabric.ManagedAzResiliencyStatus.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedAzResiliencyStatusOperations.get": "Microsoft.ServiceFabric.ManagedAzResiliencyStatus.get", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedApplyMaintenanceWindowOperations.post": "Microsoft.ServiceFabric.ManagedApplyMaintenanceWindow.post", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedApplyMaintenanceWindowOperations.post": "Microsoft.ServiceFabric.ManagedApplyMaintenanceWindow.post", + "azure.mgmt.servicefabricmanagedclusters.operations.ManagedMaintenanceWindowStatusOperations.get": "Microsoft.ServiceFabric.ManagedMaintenanceWindowStatus.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedMaintenanceWindowStatusOperations.get": "Microsoft.ServiceFabric.ManagedMaintenanceWindowStatus.get", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.get": "Microsoft.ServiceFabric.NodeTypes.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.get": "Microsoft.ServiceFabric.NodeTypes.get", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_create_or_update": "Microsoft.ServiceFabric.NodeTypes.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_create_or_update": "Microsoft.ServiceFabric.NodeTypes.createOrUpdate", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_update": "Microsoft.ServiceFabric.NodeTypes.update", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_update": "Microsoft.ServiceFabric.NodeTypes.update", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_delete": "Microsoft.ServiceFabric.NodeTypes.delete", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_delete": "Microsoft.ServiceFabric.NodeTypes.delete", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.list_by_managed_clusters": "Microsoft.ServiceFabric.NodeTypes.listByManagedClusters", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.list_by_managed_clusters": "Microsoft.ServiceFabric.NodeTypes.listByManagedClusters", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_deallocate": "Microsoft.ServiceFabric.NodeTypes.deallocate", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_deallocate": "Microsoft.ServiceFabric.NodeTypes.deallocate", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_delete_node": "Microsoft.ServiceFabric.NodeTypes.deleteNode", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_delete_node": "Microsoft.ServiceFabric.NodeTypes.deleteNode", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_redeploy": "Microsoft.ServiceFabric.NodeTypes.redeploy", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_redeploy": "Microsoft.ServiceFabric.NodeTypes.redeploy", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_reimage": "Microsoft.ServiceFabric.NodeTypes.reimage", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_reimage": "Microsoft.ServiceFabric.NodeTypes.reimage", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_restart": "Microsoft.ServiceFabric.NodeTypes.restart", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_restart": "Microsoft.ServiceFabric.NodeTypes.restart", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_start": "Microsoft.ServiceFabric.NodeTypes.start", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_start": "Microsoft.ServiceFabric.NodeTypes.start", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_start_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.startFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_start_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.startFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.begin_stop_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.stopFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.begin_stop_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.stopFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.get_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.getFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.get_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.getFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations.list_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.listFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations.list_fault_simulation": "Microsoft.ServiceFabric.NodeTypes.listFaultSimulation", + "azure.mgmt.servicefabricmanagedclusters.operations.NodeTypeSkusOperations.list": "Microsoft.ServiceFabric.NodeTypeSkus.list", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypeSkusOperations.list": "Microsoft.ServiceFabric.NodeTypeSkus.list", + "azure.mgmt.servicefabricmanagedclusters.operations.OperationResultsOperations.begin_get": "Microsoft.ServiceFabric.OperationResults.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationResultsOperations.begin_get": "Microsoft.ServiceFabric.OperationResults.get", + "azure.mgmt.servicefabricmanagedclusters.operations.OperationStatusOperations.get": "Microsoft.ServiceFabric.OperationStatus.get", + "azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationStatusOperations.get": "Microsoft.ServiceFabric.OperationStatus.get" + } +} \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py index 8d17b8644f25..bc542069560b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__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 ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient # type: ignore +from ._client import ServiceFabricManagedClustersManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_client.py similarity index 83% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_client.py index 3debc48cfb23..bac8c063d510 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_client.py @@ -2,22 +2,23 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights 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 -from typing import Any, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from . import models as _models from ._configuration import ServiceFabricManagedClustersManagementClientConfiguration -from ._serialization import Deserializer, Serializer +from ._utils.serialization import Deserializer, Serializer from .operations import ( ApplicationTypeVersionsOperations, ApplicationTypesOperations, @@ -43,71 +44,79 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=too-many-instance-attributes,name-too-long """Service Fabric Managed Clusters Management Client. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicefabricmanagedclusters.operations.Operations + :ivar applications: ApplicationsOperations operations + :vartype applications: + azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations :vartype application_type_versions: azure.mgmt.servicefabricmanagedclusters.operations.ApplicationTypeVersionsOperations - :ivar applications: ApplicationsOperations operations - :vartype applications: - azure.mgmt.servicefabricmanagedclusters.operations.ApplicationsOperations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.servicefabricmanagedclusters.operations.ServicesOperations + :ivar managed_cluster_version: ManagedClusterVersionOperations operations + :vartype managed_cluster_version: + azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations + :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations + :vartype managed_unsupported_vm_sizes: + azure.mgmt.servicefabricmanagedclusters.operations.ManagedUnsupportedVMSizesOperations :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.servicefabricmanagedclusters.operations.ManagedClustersOperations :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations :vartype managed_az_resiliency_status: azure.mgmt.servicefabricmanagedclusters.operations.ManagedAzResiliencyStatusOperations - :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations - :vartype managed_maintenance_window_status: - azure.mgmt.servicefabricmanagedclusters.operations.ManagedMaintenanceWindowStatusOperations :ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations :vartype managed_apply_maintenance_window: azure.mgmt.servicefabricmanagedclusters.operations.ManagedApplyMaintenanceWindowOperations - :ivar managed_cluster_version: ManagedClusterVersionOperations operations - :vartype managed_cluster_version: - azure.mgmt.servicefabricmanagedclusters.operations.ManagedClusterVersionOperations - :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations - :vartype managed_unsupported_vm_sizes: - azure.mgmt.servicefabricmanagedclusters.operations.ManagedUnsupportedVMSizesOperations - :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: - azure.mgmt.servicefabricmanagedclusters.operations.OperationStatusOperations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: - azure.mgmt.servicefabricmanagedclusters.operations.OperationResultsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicefabricmanagedclusters.operations.Operations + :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations + :vartype managed_maintenance_window_status: + azure.mgmt.servicefabricmanagedclusters.operations.ManagedMaintenanceWindowStatusOperations :ivar node_types: NodeTypesOperations operations :vartype node_types: azure.mgmt.servicefabricmanagedclusters.operations.NodeTypesOperations :ivar node_type_skus: NodeTypeSkusOperations operations :vartype node_type_skus: azure.mgmt.servicefabricmanagedclusters.operations.NodeTypeSkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + azure.mgmt.servicefabricmanagedclusters.operations.OperationResultsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.servicefabricmanagedclusters.operations.OperationStatusOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The customer subscription identifier. 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 "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-03-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) 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 = ServiceFabricManagedClustersManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -126,55 +135,54 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=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.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.application_types = ApplicationTypesOperations( self._client, self._config, self._serialize, self._deserialize ) self.application_type_versions = ApplicationTypeVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations( + self.managed_cluster_version = ManagedClusterVersionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( + self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_cluster_version = ManagedClusterVersionOperations( + self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( + self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status = OperationStatusOperations( + self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_type_skus = NodeTypeSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_results = OperationResultsOperations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_type_skus = NodeTypeSkusOperations(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 @@ -187,7 +195,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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py index 88375567fa4b..0aac5c5caf5b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -23,17 +24,26 @@ class ServiceFabricManagedClustersManagementClientConfiguration: # pylint: disa 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 customer subscription identifier. 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 "2024-09-01-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 + :keyword api_version: The API version to use for this operation. Default value is + "2025-03-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +52,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicefabricmanagedclusters/{}".format(VERSION)) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json deleted file mode 100644 index 080c42d45b0e..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2022-02-01-preview", - "total_api_version_list": ["2022-02-01-preview"], - "client": { - "name": "ServiceFabricManagedClustersManagementClient", - "filename": "_service_fabric_managed_clusters_management_client", - "description": "Service Fabric Managed Clusters Management Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The customer subscription identifier.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The customer subscription identifier.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=\"https://management.azure.com\", # type: str", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "application_types": "ApplicationTypesOperations", - "application_type_versions": "ApplicationTypeVersionsOperations", - "applications": "ApplicationsOperations", - "services": "ServicesOperations", - "managed_clusters": "ManagedClustersOperations", - "managed_az_resiliency_status": "ManagedAzResiliencyStatusOperations", - "managed_cluster_version": "ManagedClusterVersionOperations", - "managed_unsupported_vm_sizes": "ManagedUnsupportedVMSizesOperations", - "operation_status": "OperationStatusOperations", - "operation_results": "OperationResultsOperations", - "operations": "Operations", - "node_types": "NodeTypesOperations", - "node_type_skus": "NodeTypeSkusOperations" - } -} \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py index 17dbc073e01b..8bcb627aa475 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py @@ -1,32 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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 -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/__init__.py similarity index 50% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/__init__.py index 0dafe0e287ff..8026245c2abc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/__init__.py @@ -1,16 +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. # -------------------------------------------------------------------------- - -from azure.core.pipeline.transport import HttpRequest - - -def _convert_request(request, files=None): - data = request.content if not files else None - request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) - if files: - request.set_formdata_body(files) - return request diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/model_base.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/model_base.py new file mode 100644 index 000000000000..49d5c7259389 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/model_base.py @@ -0,0 +1,1232 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +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" +) + + +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 + + +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) + + +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 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: typing.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: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + 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) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + 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: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.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: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.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: typing.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: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.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-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 for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), 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 != type(None)] # 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: + if annotation._name == "Dict": # pyright: ignore + 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: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @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 + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + 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[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.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: typing.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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/serialization.py similarity index 93% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/serialization.py index ce17d1798ce7..eb86ea23c965 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_serialization.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_utils/serialization.py @@ -1,28 +1,10 @@ -# pylint: disable=too-many-lines +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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. # -------------------------------------------------------------------------- # pyright: reportUnnecessaryTypeIgnoreComment=false @@ -48,9 +30,7 @@ IO, Mapping, Callable, - TypeVar, MutableMapping, - Type, List, ) @@ -61,13 +41,13 @@ 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 _BOM = codecs.BOM_UTF8.decode(encoding="utf-8") -ModelType = TypeVar("ModelType", bound="Model") JSON = MutableMapping[str, Any] @@ -185,73 +165,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]], except NameError: _long_type = int - -class UTC(datetime.tzinfo): - """Time Zone info for handling UTC""" - - def utcoffset(self, dt): - """UTF offset for UTC is 0. - - :param datetime.datetime dt: The datetime - :returns: The offset - :rtype: datetime.timedelta - """ - return datetime.timedelta(0) - - def tzname(self, dt): - """Timestamp representation. - - :param datetime.datetime dt: The datetime - :returns: The timestamp representation - :rtype: str - """ - return "Z" - - def dst(self, dt): - """No daylight saving for UTC. - - :param datetime.datetime dt: The datetime - :returns: The daylight saving time - :rtype: datetime.timedelta - """ - return datetime.timedelta(hours=1) - - -try: - from datetime import timezone as _FixedOffset # type: ignore -except ImportError: # Python 2.7 - - class _FixedOffset(datetime.tzinfo): # type: ignore - """Fixed offset in minutes east from UTC. - Copy/pasted from Python doc - :param datetime.timedelta offset: offset in timedelta format - """ - - def __init__(self, offset) -> None: - self.__offset = offset - - def utcoffset(self, dt): - return self.__offset - - def tzname(self, dt): - return str(self.__offset.total_seconds() / 3600) - - def __repr__(self): - return "".format(self.tzname(None)) - - def dst(self, dt): - return datetime.timedelta(0) - - def __getinitargs__(self): - return (self.__offset,) - - -try: - from datetime import timezone - - TZ_UTC = timezone.utc -except ImportError: - TZ_UTC = UTC() # type: ignore +TZ_UTC = datetime.timezone.utc _FLATTEN = re.compile(r"(? ModelType: + def deserialize(cls, data: Any, content_type: Optional[str] = None) -> Self: """Parse a str using the RestAPI syntax and return a model. :param str data: A str using RestAPI structure. JSON by default. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) return deserializer(cls.__name__, data, content_type=content_type) # type: ignore @classmethod def from_dict( - cls: Type[ModelType], + cls, data: Any, key_extractors: Optional[Callable[[str, Dict[str, Any], Any], Any]] = None, content_type: Optional[str] = None, - ) -> ModelType: + ) -> Self: """Parse a dict using given key extractor return a model. By default consider key @@ -479,8 +393,8 @@ def from_dict( :param function key_extractors: A key extractor function. :param str content_type: JSON by default, set application/xml if XML. :returns: An instance of this model - :raises: DeserializationError if something went wrong - :rtype: ModelType + :raises DeserializationError: if something went wrong + :rtype: Self """ deserializer = Deserializer(cls._infer_class_models()) deserializer.key_extractors = ( # type: ignore @@ -563,7 +477,7 @@ def _decode_attribute_map_key(key): return key.replace("\\.", ".") -class Serializer(object): # pylint: disable=too-many-public-methods +class Serializer: # pylint: disable=too-many-public-methods """Request object model serializer.""" basic_types = {str: "str", int: "int", bool: "bool", float: "float"} @@ -626,7 +540,7 @@ def _serialize( # pylint: disable=too-many-nested-blocks, too-many-branches, to :param object target_obj: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, dict - :raises: SerializationError if serialization fails. + :raises SerializationError: if serialization fails. :returns: The serialized data. """ key_transformer = kwargs.get("key_transformer", self.key_transformer) @@ -736,8 +650,8 @@ def body(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: dict - :raises: SerializationError if serialization fails. - :raises: ValueError if data is None + :raises SerializationError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized request body """ @@ -781,8 +695,8 @@ def url(self, name, data, data_type, **kwargs): :param str data_type: The type to be serialized from. :rtype: str :returns: The serialized URL path - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None """ try: output = self.serialize_data(data, data_type, **kwargs) @@ -805,8 +719,8 @@ def query(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str, list - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized query parameter """ try: @@ -835,8 +749,8 @@ def header(self, name, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. :rtype: str - :raises: TypeError if serialization fails. - :raises: ValueError if data is None + :raises TypeError: if serialization fails. + :raises ValueError: if data is None :returns: The serialized header """ try: @@ -855,9 +769,9 @@ def serialize_data(self, data, data_type, **kwargs): :param object data: The data to be serialized. :param str data_type: The type to be serialized from. - :raises: AttributeError if required data is None. - :raises: ValueError if data is None - :raises: SerializationError if serialization fails. + :raises AttributeError: if required data is None. + :raises ValueError: if data is None + :raises SerializationError: if serialization fails. :returns: The serialized data. :rtype: str, int, float, bool, dict, list """ @@ -1192,7 +1106,7 @@ def serialize_rfc(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: TypeError if format invalid. + :raises TypeError: if format invalid. :return: serialized rfc """ try: @@ -1218,7 +1132,7 @@ def serialize_iso(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: str - :raises: SerializationError if format invalid. + :raises SerializationError: if format invalid. :return: serialized iso """ if isinstance(attr, str): @@ -1251,7 +1165,7 @@ def serialize_unix(attr, **kwargs): # pylint: disable=unused-argument :param Datetime attr: Object to be serialized. :rtype: int - :raises: SerializationError if format invalid + :raises SerializationError: if format invalid :return: serialied unix """ if isinstance(attr, int): @@ -1429,7 +1343,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument # Iter and wrapped, should have found one node only (the wrap one) if len(children) != 1: raise DeserializationError( - "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( # pylint: disable=line-too-long + "Tried to deserialize an array not wrapped, and found several nodes '{}'. Maybe you should declare this array as wrapped?".format( xml_name ) ) @@ -1441,7 +1355,7 @@ def xml_key_extractor(attr, attr_desc, data): # pylint: disable=unused-argument return children[0] -class Deserializer(object): +class Deserializer: """Response object model deserializer. :param dict classes: Class type dictionary for deserializing complex types. @@ -1488,7 +1402,7 @@ def __call__(self, target_obj, response_data, content_type=None): :param str target_obj: Target data type to deserialize to. :param requests.Response response_data: REST response object. :param str content_type: Swagger "produces" if available. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1502,7 +1416,7 @@ def _deserialize(self, target_obj, data): # pylint: disable=inconsistent-return :param str target_obj: Target data type to deserialize to. :param object data: Object to deserialize. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1683,17 +1597,21 @@ def _instantiate_model(self, response, attrs, additional_properties=None): subtype = getattr(response, "_subtype_map", {}) try: readonly = [ - k for k, v in response._validation.items() if v.get("readonly") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("readonly") ] const = [ - k for k, v in response._validation.items() if v.get("constant") # pylint: disable=protected-access + k + for k, v in response._validation.items() # pylint: disable=protected-access # type: ignore + if v.get("constant") ] kwargs = {k: v for k, v in attrs.items() if k not in subtype and k not in readonly + const} response_obj = response(**kwargs) for attr in readonly: setattr(response_obj, attr, attrs.get(attr)) if additional_properties: - response_obj.additional_properties = additional_properties + response_obj.additional_properties = additional_properties # type: ignore return response_obj except TypeError as err: msg = "Unable to deserialize {} into model {}. ".format(kwargs, response) # type: ignore @@ -1713,7 +1631,7 @@ def deserialize_data(self, data, data_type): # pylint: disable=too-many-return- :param str data: The response string to be deserialized. :param str data_type: The type to deserialize to. - :raises: DeserializationError if deserialization fails. + :raises DeserializationError: if deserialization fails. :return: Deserialized object. :rtype: object """ @@ -1795,7 +1713,7 @@ def deserialize_object(self, attr, **kwargs): # pylint: disable=too-many-return :param dict attr: Dictionary to be deserialized. :return: Deserialized object. :rtype: dict - :raises: TypeError if non-builtin datatype encountered. + :raises TypeError: if non-builtin datatype encountered. """ if attr is None: return None @@ -1841,7 +1759,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. """ # If we're here, data is supposed to be a basic type. # If it's still an XML node, take the text @@ -1932,7 +1850,7 @@ def deserialize_bytearray(attr): :param str attr: response string to be deserialized. :return: Deserialized bytearray :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1945,7 +1863,7 @@ def deserialize_base64(attr): :param str attr: response string to be deserialized. :return: Deserialized base64 string :rtype: bytearray - :raises: TypeError if string format invalid. + :raises TypeError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1960,7 +1878,7 @@ def deserialize_decimal(attr): :param str attr: response string to be deserialized. :return: Deserialized decimal - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. :rtype: decimal """ if isinstance(attr, ET.Element): @@ -1978,7 +1896,7 @@ def deserialize_long(attr): :param str attr: response string to be deserialized. :return: Deserialized int :rtype: long or int - :raises: ValueError if string format invalid. + :raises ValueError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -1991,7 +1909,7 @@ def deserialize_duration(attr): :param str attr: response string to be deserialized. :return: Deserialized duration :rtype: TimeDelta - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2009,7 +1927,7 @@ def deserialize_date(attr): :param str attr: response string to be deserialized. :return: Deserialized date :rtype: Date - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2025,7 +1943,7 @@ def deserialize_time(attr): :param str attr: response string to be deserialized. :return: Deserialized time :rtype: datetime.time - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2040,14 +1958,14 @@ def deserialize_rfc(attr): :param str attr: response string to be deserialized. :return: Deserialized RFC datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text try: parsed_date = email.utils.parsedate_tz(attr) # type: ignore date_obj = datetime.datetime( - *parsed_date[:6], tzinfo=_FixedOffset(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) + *parsed_date[:6], tzinfo=datetime.timezone(datetime.timedelta(minutes=(parsed_date[9] or 0) / 60)) ) if not date_obj.tzinfo: date_obj = date_obj.astimezone(tz=TZ_UTC) @@ -2063,7 +1981,7 @@ def deserialize_iso(attr): :param str attr: response string to be deserialized. :return: Deserialized ISO datetime :rtype: Datetime - :raises: DeserializationError if string format invalid. + :raises DeserializationError: if string format invalid. """ if isinstance(attr, ET.Element): attr = attr.text @@ -2101,7 +2019,7 @@ def deserialize_unix(attr): :param int attr: Object to be serialized. :return: Deserialized datetime :rtype: Datetime - :raises: DeserializationError if format invalid + :raises DeserializationError: if format invalid """ if isinstance(attr, ET.Element): attr = int(attr.text) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py index b2fff948b5bb..c52241e4c93b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_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 = "2.1.0b2" +VERSION = "2.1.0b3" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py index fdbc1bd233a2..2cc4e82dbf5f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/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 ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient # type: ignore +from ._client import ServiceFabricManagedClustersManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_client.py similarity index 83% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_client.py index a068644409f6..595c956cb167 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_client.py @@ -2,21 +2,22 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights 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 -from typing import Any, Awaitable, TYPE_CHECKING +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 +from azure.core.settings import settings from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy +from azure.mgmt.core.tools import get_arm_endpoints -from .. import models as _models -from .._serialization import Deserializer, Serializer +from .._utils.serialization import Deserializer, Serializer from ._configuration import ServiceFabricManagedClustersManagementClientConfiguration from .operations import ( ApplicationTypeVersionsOperations, @@ -43,71 +44,79 @@ class ServiceFabricManagedClustersManagementClient: # pylint: disable=too-many-instance-attributes,name-too-long """Service Fabric Managed Clusters Management Client. + :ivar operations: Operations operations + :vartype operations: azure.mgmt.servicefabricmanagedclusters.aio.operations.Operations + :ivar applications: ApplicationsOperations operations + :vartype applications: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations :vartype application_type_versions: azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationTypeVersionsOperations - :ivar applications: ApplicationsOperations operations - :vartype applications: - azure.mgmt.servicefabricmanagedclusters.aio.operations.ApplicationsOperations :ivar services: ServicesOperations operations :vartype services: azure.mgmt.servicefabricmanagedclusters.aio.operations.ServicesOperations + :ivar managed_cluster_version: ManagedClusterVersionOperations operations + :vartype managed_cluster_version: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations + :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations + :vartype managed_unsupported_vm_sizes: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedUnsupportedVMSizesOperations :ivar managed_clusters: ManagedClustersOperations operations :vartype managed_clusters: azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClustersOperations :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations :vartype managed_az_resiliency_status: azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedAzResiliencyStatusOperations - :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations - :vartype managed_maintenance_window_status: - azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedMaintenanceWindowStatusOperations :ivar managed_apply_maintenance_window: ManagedApplyMaintenanceWindowOperations operations :vartype managed_apply_maintenance_window: azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedApplyMaintenanceWindowOperations - :ivar managed_cluster_version: ManagedClusterVersionOperations operations - :vartype managed_cluster_version: - azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedClusterVersionOperations - :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations - :vartype managed_unsupported_vm_sizes: - azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedUnsupportedVMSizesOperations - :ivar operation_status: OperationStatusOperations operations - :vartype operation_status: - azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationStatusOperations - :ivar operation_results: OperationResultsOperations operations - :vartype operation_results: - azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationResultsOperations - :ivar operations: Operations operations - :vartype operations: azure.mgmt.servicefabricmanagedclusters.aio.operations.Operations + :ivar managed_maintenance_window_status: ManagedMaintenanceWindowStatusOperations operations + :vartype managed_maintenance_window_status: + azure.mgmt.servicefabricmanagedclusters.aio.operations.ManagedMaintenanceWindowStatusOperations :ivar node_types: NodeTypesOperations operations :vartype node_types: azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypesOperations :ivar node_type_skus: NodeTypeSkusOperations operations :vartype node_type_skus: azure.mgmt.servicefabricmanagedclusters.aio.operations.NodeTypeSkusOperations - :param credential: Credential needed for the client to connect to Azure. Required. + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationResultsOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + azure.mgmt.servicefabricmanagedclusters.aio.operations.OperationStatusOperations + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The customer subscription identifier. 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 "https://management.azure.com". + :param base_url: Service host. Default value is None. :type base_url: str - :keyword api_version: Api Version. Default value is "2024-09-01-preview". Note that overriding - this default value may result in unsupported behavior. + :keyword api_version: The API version to use for this operation. Default value is + "2025-03-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any ) -> None: + _endpoint = "{endpoint}" + _cloud = kwargs.pop("cloud_setting", None) 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 = ServiceFabricManagedClustersManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs + credential=credential, + subscription_id=subscription_id, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs ) + _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -126,49 +135,50 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + 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.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.application_types = ApplicationTypesOperations( self._client, self._config, self._serialize, self._deserialize ) self.application_type_versions = ApplicationTypeVersionsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.managed_clusters = ManagedClustersOperations( + self.managed_cluster_version = ManagedClusterVersionOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( + self.managed_clusters = ManagedClustersOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_cluster_version = ManagedClusterVersionOperations( + self.managed_apply_maintenance_window = ManagedApplyMaintenanceWindowOperations( self._client, self._config, self._serialize, self._deserialize ) - self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations( + self.managed_maintenance_window_status = ManagedMaintenanceWindowStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_status = OperationStatusOperations( + self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_type_skus = NodeTypeSkusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operation_results = OperationResultsOperations( + self.operation_status = OperationStatusOperations( self._client, self._config, self._serialize, self._deserialize ) - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.node_type_skus = NodeTypeSkusOperations(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. @@ -176,7 +186,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 @@ -189,7 +199,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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py index fdc85649b4bc..85ff6a21f698 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -23,17 +24,26 @@ class ServiceFabricManagedClustersManagementClientConfiguration: # pylint: disa 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 customer subscription identifier. 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 "2024-09-01-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 + :keyword api_version: The API version to use for this operation. Default value is + "2025-03-01-preview". Note that overriding this default value may result in unsupported + behavior. :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-09-01-preview") + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2025-03-01-preview") if credential is None: raise ValueError("Parameter 'credential' must not be None.") @@ -42,6 +52,7 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-servicefabricmanagedclusters/{}".format(VERSION)) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py index 17dbc073e01b..8bcb627aa475 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py @@ -1,32 +1,21 @@ # coding=utf-8 # -------------------------------------------------------------------------- -# # Copyright (c) Microsoft Corporation. All rights reserved. -# -# The MIT License (MIT) -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the ""Software""), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -# IN THE SOFTWARE. -# +# 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 -# This file is used for handwritten extensions to the generated code. Example: -# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md def patch_sdk(): - pass + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py index 87179ac04eb7..1e2afebaee4f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,42 +12,42 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._application_types_operations import ApplicationTypesOperations # type: ignore -from ._application_type_versions_operations import ApplicationTypeVersionsOperations # type: ignore -from ._applications_operations import ApplicationsOperations # type: ignore -from ._services_operations import ServicesOperations # type: ignore -from ._managed_clusters_operations import ManagedClustersOperations # type: ignore -from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations # type: ignore -from ._managed_maintenance_window_status_operations import ManagedMaintenanceWindowStatusOperations # type: ignore -from ._managed_apply_maintenance_window_operations import ManagedApplyMaintenanceWindowOperations # type: ignore -from ._managed_cluster_version_operations import ManagedClusterVersionOperations # type: ignore -from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations # type: ignore -from ._operation_status_operations import OperationStatusOperations # type: ignore -from ._operation_results_operations import OperationResultsOperations # type: ignore from ._operations import Operations # type: ignore -from ._node_types_operations import NodeTypesOperations # type: ignore -from ._node_type_skus_operations import NodeTypeSkusOperations # type: ignore +from ._operations import ApplicationsOperations # type: ignore +from ._operations import ApplicationTypesOperations # type: ignore +from ._operations import ApplicationTypeVersionsOperations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import ManagedClusterVersionOperations # type: ignore +from ._operations import ManagedUnsupportedVMSizesOperations # type: ignore +from ._operations import ManagedClustersOperations # type: ignore +from ._operations import ManagedAzResiliencyStatusOperations # type: ignore +from ._operations import ManagedApplyMaintenanceWindowOperations # type: ignore +from ._operations import ManagedMaintenanceWindowStatusOperations # type: ignore +from ._operations import NodeTypesOperations # type: ignore +from ._operations import NodeTypeSkusOperations # type: ignore +from ._operations import OperationResultsOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", + "ApplicationsOperations", "ApplicationTypesOperations", "ApplicationTypeVersionsOperations", - "ApplicationsOperations", "ServicesOperations", + "ManagedClusterVersionOperations", + "ManagedUnsupportedVMSizesOperations", "ManagedClustersOperations", "ManagedAzResiliencyStatusOperations", - "ManagedMaintenanceWindowStatusOperations", "ManagedApplyMaintenanceWindowOperations", - "ManagedClusterVersionOperations", - "ManagedUnsupportedVMSizesOperations", - "OperationStatusOperations", - "OperationResultsOperations", - "Operations", + "ManagedMaintenanceWindowStatusOperations", "NodeTypesOperations", "NodeTypeSkusOperations", + "OperationResultsOperations", + "OperationStatusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py deleted file mode 100644 index 60a50d0817eb..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py +++ /dev/null @@ -1,747 +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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._application_type_versions_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_application_types_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationTypeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`application_type_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Gets a Service Fabric managed application type version resource. - - Get a Service Fabric managed application type version resource created or in the process of - being created in the Service Fabric managed application type name resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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.ApplicationTypeVersionResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeVersionResource", 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, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionResource, 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, "ApplicationTypeVersionResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_type_name: str, - version: str, - parameters: _models.ApplicationTypeVersionResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: - # pylint: disable=line-too-long - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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 ApplicationTypeVersionResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: - # pylint: disable=line-too-long - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. 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 ApplicationTypeVersionResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: - # pylint: disable=line-too-long - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. Is either a - ApplicationTypeVersionResource type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or - the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :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.ApplicationTypeVersionResource] = 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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("ApplicationTypeVersionResource", 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.ApplicationTypeVersionResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationTypeVersionResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: _models.ApplicationTypeVersionUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. Is either a - ApplicationTypeVersionUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters or - IO[bytes] - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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.ApplicationTypeVersionResource] = 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, "ApplicationTypeVersionUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeVersionResource", 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, cluster_name: str, application_type_name: str, version: 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_type_name: str, version: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Service Fabric managed application type version resource. - - Delete a Service Fabric managed application type version resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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 - def list_by_application_types( - self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationTypeVersionResource"]: - # pylint: disable=line-too-long - """Gets the list of application type version resources created in the specified Service Fabric - managed application type name resource. - - Gets all application type version resources created or in the process of being created in the - Service Fabric managed application type name resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :return: An iterator like instance of either ApplicationTypeVersionResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :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.ApplicationTypeVersionResourceList] = 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_application_types_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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("ApplicationTypeVersionResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py deleted file mode 100644 index 8e0c83c14d5a..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py +++ /dev/null @@ -1,627 +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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._application_types_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`application_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Gets a Service Fabric managed application type name resource. - - Get a Service Fabric application type name resource created or in the process of being created - in the Service Fabric managed cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, - cluster_name: str, - application_type_name: str, - parameters: _models.ApplicationTypeResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. 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: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: Union[_models.ApplicationTypeResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. Is either a ApplicationTypeResource type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource or - IO[bytes] - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = 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, "ApplicationTypeResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, - cluster_name: str, - application_type_name: str, - parameters: _models.ApplicationTypeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. 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: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: Union[_models.ApplicationTypeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. Is either a - ApplicationTypeUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters or IO[bytes] - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = 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, "ApplicationTypeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, cluster_name: str, application_type_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, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, 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, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Service Fabric managed application type name resource. - - Delete a Service Fabric managed application type name resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_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, - cluster_name=cluster_name, - application_type_name=application_type_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 - def list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationTypeResource"]: - # pylint: disable=line-too-long - """Gets the list of application type name resources created in the specified Service Fabric - managed cluster resource. - - Gets all application type name resources created or in the process of being created in the - Service Fabric managed cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either ApplicationTypeResource or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] - :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.ApplicationTypeResourceList] = 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, - cluster_name=cluster_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("ApplicationTypeResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py deleted file mode 100644 index 4d40d3272863..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py +++ /dev/null @@ -1,1163 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._applications_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_request, - build_read_upgrade_request, - build_resume_upgrade_request, - build_start_rollback_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`applications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - async def _read_upgrade_initial( - self, resource_group_name: str, cluster_name: str, application_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_read_upgrade_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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]: - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_read_upgrade( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Get the status of the latest application upgrade. - - Get the status of the latest application upgrade. It will query the cluster to find the status - of the latest application upgrade. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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._read_upgrade_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_rollback_initial( - self, resource_group_name: str, cluster_name: str, application_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_start_rollback_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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]: - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_start_rollback( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Send a request to start a rollback of the current application upgrade. - - Send a request to start a rollback of the current application upgrade. This will start rolling - back the application to the previous version. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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._start_rollback_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _resume_upgrade_initial( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, 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, "RuntimeResumeApplicationUpgradeParameters") - - _request = build_resume_upgrade_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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 [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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: _models.RuntimeResumeApplicationUpgradeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters - :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_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Is either a - RuntimeResumeApplicationUpgradeParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters 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._resume_upgrade_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> _models.ApplicationResource: - """Gets a Service Fabric managed application resource. - - Get a Service Fabric managed application resource created or in the process of being created in - the Service Fabric cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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.ApplicationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationResource", 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, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationResource, 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, "ApplicationResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_name: str, - parameters: _models.ApplicationResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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 ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. 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 ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. Is either a ApplicationResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :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.ApplicationResource] = 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, - cluster_name=cluster_name, - application_name=application_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("ApplicationResource", 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.ApplicationResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ApplicationResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: _models.ApplicationUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. 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: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. Is either a - ApplicationUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters - or IO[bytes] - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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.ApplicationResource] = 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, "ApplicationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationResource", 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, cluster_name: str, application_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, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Service Fabric managed application resource. - - Delete a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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, - cluster_name=cluster_name, - application_name=application_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 - def list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ApplicationResource"]: - """Gets the list of managed application resources created in the specified Service Fabric cluster - resource. - - Gets all managed application resources created or in the process of being created in the - Service Fabric cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either ApplicationResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :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.ApplicationResourceList] = 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, - cluster_name=cluster_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("ApplicationResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py deleted file mode 100644 index 5b8594cf8e9c..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_apply_maintenance_window_operations.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 ...operations._managed_apply_maintenance_window_operations import build_post_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedApplyMaintenanceWindowOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_apply_maintenance_window` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def post(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> None: - """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any - pending update will be applied. - - Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any - pending update will be applied. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py deleted file mode 100644 index 7dac5853fc9a..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py +++ /dev/null @@ -1,114 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 ...operations._managed_az_resiliency_status_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedAzResiliencyStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_az_resiliency_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> _models.ManagedAzResiliencyStatus: - """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric - Managed Clusters. - - Action to get Az Resiliency Status of all the Base resources constituting Service Fabric - Managed Clusters. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedAzResiliencyStatus or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus - :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.ManagedAzResiliencyStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedAzResiliencyStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py deleted file mode 100644 index 22044eb4db52..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py +++ /dev/null @@ -1,304 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union - -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 ...operations._managed_cluster_version_operations import ( - build_get_by_environment_request, - build_get_request, - build_list_by_environment_request, - build_list_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedClusterVersionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_cluster_version` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, location: str, cluster_version: str, **kwargs: Any) -> _models.ManagedClusterCodeVersionResult: - """Gets information about a Service Fabric managed cluster code version available in the specified - location. - - Gets information about an available Service Fabric managed cluster code version. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param cluster_version: The cluster code version. Required. - :type cluster_version: str - :return: ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult - :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - cluster_version=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedClusterCodeVersionResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get_by_environment( - self, - location: str, - environment: Union[str, _models.ManagedClusterVersionEnvironment], - cluster_version: str, - **kwargs: Any - ) -> _models.ManagedClusterCodeVersionResult: - """Gets information about a Service Fabric cluster code version available for the specified - environment. - - Gets information about an available Service Fabric cluster code version by environment. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param environment: The operating system of the cluster. The default means all. "Windows" - Required. - :type environment: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment - :param cluster_version: The cluster code version. Required. - :type cluster_version: str - :return: ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult - :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) - - _request = build_get_by_environment_request( - location=location, - environment=environment, - cluster_version=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedClusterCodeVersionResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list(self, location: str, **kwargs: Any) -> List[_models.ManagedClusterCodeVersionResult]: - """Gets the list of Service Fabric cluster code versions available for the specified location. - - Gets all available code versions for Service Fabric cluster resources by location. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :return: list of ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] - :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ManagedClusterCodeVersionResult]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def list_by_environment( - self, location: str, environment: Union[str, _models.ManagedClusterVersionEnvironment], **kwargs: Any - ) -> List[_models.ManagedClusterCodeVersionResult]: - """Gets the list of Service Fabric cluster code versions available for the specified environment. - - Gets all available code versions for Service Fabric cluster resources by environment. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param environment: The operating system of the cluster. The default means all. "Windows" - Required. - :type environment: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment - :return: list of ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] - :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) - - _request = build_list_by_environment_request( - location=location, - environment=environment, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ManagedClusterCodeVersionResult]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py deleted file mode 100644 index a5058f2b2038..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py +++ /dev/null @@ -1,745 +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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._managed_clusters_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, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group( - self, resource_group_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ManagedCluster"]: - """Gets the list of Service Fabric cluster resources created in the specified resource group. - - Gets all Service Fabric cluster resources created or in the process of being created in the - resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either ManagedCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :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.ManagedClusterListResult] = 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("ManagedClusterListResult", 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.ErrorModel, 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) -> AsyncIterable["_models.ManagedCluster"]: - """Gets the list of Service Fabric cluster resources created in the specified subscription. - - Gets all Service Fabric cluster resources created or in the process of being created in the - subscription. - - :return: An iterator like instance of either ManagedCluster or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :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.ManagedClusterListResult] = 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("ManagedClusterListResult", 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.ErrorModel, 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, cluster_name: str, **kwargs: Any) -> _models.ManagedCluster: - """Gets a Service Fabric managed cluster resource. - - Get a Service Fabric managed cluster resource created or in the process of being created in the - specified resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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.ManagedCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedCluster", 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, - cluster_name: str, - parameters: Union[_models.ManagedCluster, 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, "ManagedCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - parameters: _models.ManagedCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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 ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. 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 ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - parameters: Union[_models.ManagedCluster, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. Is either a ManagedCluster type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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.ManagedCluster] = 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, - cluster_name=cluster_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("ManagedCluster", 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.ManagedCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ManagedCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: _models.ManagedClusterUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. 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: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: Union[_models.ManagedClusterUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. Is either a - ManagedClusterUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters or IO[bytes] - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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.ManagedCluster] = 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, "ManagedClusterUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedCluster", 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, cluster_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, - cluster_name=cluster_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: - """Deletes a Service Fabric managed cluster resource. - - Delete a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_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, - cluster_name=cluster_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py deleted file mode 100644 index b08a8c55758e..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_maintenance_window_status_operations.py +++ /dev/null @@ -1,112 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 ...operations._managed_maintenance_window_status_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedMaintenanceWindowStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_maintenance_window_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> _models.ManagedMaintenanceWindowStatus: - """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. - - Action to get Maintenance Window Status of the Service Fabric Managed Clusters. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedMaintenanceWindowStatus or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus - :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.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedMaintenanceWindowStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py deleted file mode 100644 index 3555160fba10..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 ...operations._managed_unsupported_vm_sizes_operations import build_get_request, build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ManagedUnsupportedVMSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_unsupported_vm_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ManagedVMSize"]: - """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - - Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :return: An iterator like instance of either ManagedVMSize or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] - :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.ManagedVMSizesResult] = 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, - 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("ManagedVMSizesResult", 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.ErrorModel, 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, location: str, vm_size: str, **kwargs: Any) -> _models.ManagedVMSize: - """Get unsupported vm size for Service Fabric Managed Clusters. - - Get unsupported vm size for Service Fabric Managed Clusters. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param vm_size: VM Size name. Required. - :type vm_size: str - :return: ManagedVMSize or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize - :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.ManagedVMSize] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - vm_size=vm_size, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedVMSize", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py deleted file mode 100644 index 559caf67546f..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py +++ /dev/null @@ -1,145 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar -import urllib.parse - -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 ...operations._node_type_skus_operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NodeTypeSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`node_type_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NodeTypeAvailableSku"]: - """Gets a Service Fabric node type SKUs. - - Get a Service Fabric node type supported SKUs. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :return: An iterator like instance of either NodeTypeAvailableSku or the result of - cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] - :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.NodeTypeListSkuResult] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeTypeListSkuResult", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py deleted file mode 100644 index 479aa3111dad..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py +++ /dev/null @@ -1,1422 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._node_types_operations import ( - build_create_or_update_request, - build_delete_node_request, - build_delete_request, - build_get_request, - build_list_by_managed_clusters_request, - build_reimage_request, - build_restart_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class NodeTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`node_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_managed_clusters( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> AsyncIterable["_models.NodeType"]: - """Gets the list of Node types of the specified managed cluster. - - Gets all Node types of the specified managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either NodeType or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeTypeListResult] = 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_managed_clusters_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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("NodeTypeListResult", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - async def _restart_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_restart_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Is either a NodeTypeActionParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._restart_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _reimage_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_reimage_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Is either a NodeTypeActionParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._reimage_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _delete_node_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_delete_node_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Is either a NodeTypeActionParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._delete_node_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any - ) -> _models.NodeType: - """Gets a Service Fabric node type. - - Get a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :return: NodeType or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType - :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.NodeType] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NodeType", 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, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeType, 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, "NodeType") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeType, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType - :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 NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. 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 NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeType, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. Is either a NodeType type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType or IO[bytes] - :return: An instance of AsyncLROPoller that returns either NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeType] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeType", 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.NodeType].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NodeType]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeUpdateParameters, 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, "NodeTypeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters - :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 NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. 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 NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. Is either a - NodeTypeUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters or - IO[bytes] - :return: An instance of AsyncLROPoller that returns either NodeType or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeType] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeType", 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.NodeType].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.NodeType]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, cluster_name: str, node_type_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, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, node_type_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Service Fabric node type. - - Delete a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_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, - cluster_name=cluster_name, - node_type_name=node_type_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py deleted file mode 100644 index 33c0dfcf76f9..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 ...operations._operation_results_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`operation_results` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, location: str, operation_id: str, **kwargs: Any) -> None: - """Get long running operation result. - - Get long running operation result. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param operation_id: operation identifier. Required. - :type operation_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, 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")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py deleted file mode 100644 index de24e4418059..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py +++ /dev/null @@ -1,111 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 ...operations._operation_status_operations import build_get_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.LongRunningOperationResult: - """Get long running operation status. - - Get long running operation status. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param operation_id: operation identifier. Required. - :type operation_id: str - :return: LongRunningOperationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult - :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.LongRunningOperationResult] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LongRunningOperationResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py index 023eb1dbeb34..f1510190bc58 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py @@ -1,14 +1,18 @@ +# 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. # -------------------------------------------------------------------------- -import sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, 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, @@ -16,23 +20,90 @@ 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 ...operations._operations import build_list_request +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_application_type_versions_create_or_update_request, + build_application_type_versions_delete_request, + build_application_type_versions_get_request, + build_application_type_versions_list_by_application_types_request, + build_application_type_versions_update_request, + build_application_types_create_or_update_request, + build_application_types_delete_request, + build_application_types_get_request, + build_application_types_list_request, + build_application_types_update_request, + build_applications_create_or_update_request, + build_applications_delete_request, + build_applications_get_request, + build_applications_list_request, + build_applications_read_upgrade_request, + build_applications_resume_upgrade_request, + build_applications_start_rollback_request, + build_applications_update_request, + build_managed_apply_maintenance_window_post_request, + build_managed_az_resiliency_status_get_request, + build_managed_cluster_version_get_by_environment_request, + build_managed_cluster_version_get_request, + build_managed_cluster_version_list_by_environment_request, + build_managed_cluster_version_list_request, + build_managed_clusters_create_or_update_request, + build_managed_clusters_delete_request, + build_managed_clusters_get_fault_simulation_request, + build_managed_clusters_get_request, + build_managed_clusters_list_by_resource_group_request, + build_managed_clusters_list_by_subscription_request, + build_managed_clusters_list_fault_simulation_request, + build_managed_clusters_start_fault_simulation_request, + build_managed_clusters_stop_fault_simulation_request, + build_managed_clusters_update_request, + build_managed_maintenance_window_status_get_request, + build_managed_unsupported_vm_sizes_get_request, + build_managed_unsupported_vm_sizes_list_request, + build_node_type_skus_list_request, + build_node_types_create_or_update_request, + build_node_types_deallocate_request, + build_node_types_delete_node_request, + build_node_types_delete_request, + build_node_types_get_fault_simulation_request, + build_node_types_get_request, + build_node_types_list_by_managed_clusters_request, + build_node_types_list_fault_simulation_request, + build_node_types_redeploy_request, + build_node_types_reimage_request, + build_node_types_restart_request, + build_node_types_start_fault_simulation_request, + build_node_types_start_request, + build_node_types_stop_fault_simulation_request, + build_node_types_update_request, + build_operation_results_get_request, + build_operation_status_get_request, + build_operations_list_request, + build_services_create_or_update_request, + build_services_delete_request, + build_services_get_request, + build_services_list_by_applications_request, + build_services_update_request, +) +from .._configuration import ServiceFabricManagedClustersManagementClientConfiguration -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] class Operations: @@ -45,14 +116,14 @@ class Operations: :attr:`operations` attribute. """ - models = _models - def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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) -> AsyncIterable["_models.OperationResult"]: @@ -60,16 +131,753 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: Get the list of available Service Fabric resource provider API operations. - :return: An iterator like instance of either OperationResult or the result of cls(response) + :return: An iterator like instance of OperationResult :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.OperationResult] :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.OperationResult]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationResult], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`applications` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_name: str, **kwargs: Any + ) -> _models.ApplicationResource: + """Get a Service Fabric managed application resource created or in the process of being created in + the Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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.ApplicationResource] = kwargs.pop("cls", None) + + _request = build_applications_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationResource, 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, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationResource, 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_applications_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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 ApplicationResource. The + ApplicationResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. 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 ApplicationResource. The + ApplicationResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. 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 ApplicationResource. The + ApplicationResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. Is one of the following types: + ApplicationResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource or JSON + or IO[bytes] + :return: An instance of AsyncLROPoller that returns ApplicationResource. The + ApplicationResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :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.ApplicationResource] = 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, + cluster_name=cluster_name, + application_name=application_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.ApplicationResource, 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.ApplicationResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApplicationResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. 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: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. 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: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. Is one of the following types: + ApplicationUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters + or JSON or IO[bytes] + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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.ApplicationResource] = 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_applications_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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, + cluster_name=cluster_name, + application_name=application_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, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationResource"]: + """Gets all managed application resources created or in the process of being created in the + Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of ApplicationResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :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.ApplicationResource]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -82,12 +890,20 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.OperationResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_applications_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_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 @@ -102,16 +918,21 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.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.ApplicationResource], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) + return deserialized.get("nextLink") or None, AsyncList(list_of_elem) async def get_next(next_link=None): _request = prepare_request(next_link) @@ -124,9 +945,8408 @@ 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.ErrorModel, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) + + async def _read_upgrade_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_read_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_read_upgrade( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Get the status of the latest application upgrade. It will query the cluster to find the status + of the latest application upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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._read_upgrade_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_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 + + async def _resume_upgrade_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, 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_applications_resume_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeResumeApplicationUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters + :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_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is one of the following + types: RuntimeResumeApplicationUpgradeParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters 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._resume_upgrade_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _start_rollback_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_start_rollback_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_start_rollback( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Send a request to start a rollback of the current application upgrade. This will start rolling + back the application to the previous version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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._start_rollback_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ApplicationTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_types` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Get a Service Fabric application type name resource created or in the process of being created + in the Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = kwargs.pop("cls", None) + + _request = build_application_types_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, 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, + cluster_name: str, + application_type_name: str, + parameters: _models.ApplicationTypeResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: Union[_models.ApplicationTypeResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. Is one of the following types: + ApplicationTypeResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource or + JSON or IO[bytes] + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = 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_application_types_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: _models.ApplicationTypeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: Union[_models.ApplicationTypeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. Is one of the following types: + ApplicationTypeUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters or JSON or + IO[bytes] + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = 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_application_types_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_type_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_application_types_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Service Fabric managed application type name resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_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, + cluster_name=cluster_name, + application_type_name=application_type_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, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationTypeResource"]: + """Gets all application type name resources created or in the process of being created in the + Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of ApplicationTypeResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApplicationTypeResource]] = 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_application_types_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApplicationTypeResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ApplicationTypeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_type_versions` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_type_name: str, version: str, **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Get a Service Fabric managed application type version resource created or in the process of + being created in the Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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.ApplicationTypeVersionResource] = kwargs.pop("cls", None) + + _request = build_application_type_versions_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeVersionResource, 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, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionResource, 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_application_type_versions_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. 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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. 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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. Is one of the following types: + ApplicationTypeVersionResource, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :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.ApplicationTypeVersionResource] = 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, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + 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.ApplicationTypeVersionResource, 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.ApplicationTypeVersionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ApplicationTypeVersionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. Is one of the following + types: ApplicationTypeVersionUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters or JSON + or IO[bytes] + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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.ApplicationTypeVersionResource] = 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_application_type_versions_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeVersionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_type_name: str, version: 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_application_type_versions_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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) + + _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.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Service Fabric managed application type version resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: 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, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=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 + + 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_application_types( + self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ApplicationTypeVersionResource"]: + """Gets all application type version resources created or in the process of being created in the + Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :return: An iterator like instance of ApplicationTypeVersionResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApplicationTypeVersionResource]] = 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_application_type_versions_list_by_application_types_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApplicationTypeVersionResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`services` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_name: str, service_name: str, **kwargs: Any + ) -> _models.ServiceResource: + """Get a Service Fabric service resource created or in the process of being created in the Service + Fabric managed application resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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.ServiceResource] = kwargs.pop("cls", None) + + _request = build_services_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceResource, 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, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceResource, 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_services_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. 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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. 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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceResource, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. Is one of the following types: ServiceResource, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :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.ServiceResource] = 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, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_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.ServiceResource, 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.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. 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: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. 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: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. Is one of the following types: + ServiceUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters or + JSON or IO[bytes] + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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.ServiceResource] = 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_services_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_name: str, service_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_services_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_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, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_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_applications( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> AsyncIterable["_models.ServiceResource"]: + """Gets all service resources created or in the process of being created in the Service Fabric + managed application resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :return: An iterator like instance of ServiceResource + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ServiceResource]] = 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_services_list_by_applications_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ServiceResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ManagedClusterVersionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_cluster_version` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_version: str, **kwargs: Any) -> _models.ManagedClusterCodeVersionResult: + """Gets information about a Service Fabric managed cluster code version available in the specified + location. + + Gets information about an available Service Fabric managed cluster code version. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param cluster_version: The cluster code version. Required. + :type cluster_version: str + :return: ManagedClusterCodeVersionResult. The ManagedClusterCodeVersionResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult + :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_get_request( + location=location, + cluster_version=cluster_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedClusterCodeVersionResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list(self, location: str, **kwargs: Any) -> List[_models.ManagedClusterCodeVersionResult]: + """Gets the list of Service Fabric cluster code versions available for the specified location. + + Gets all available code versions for Service Fabric cluster resources by location. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :return: list of ManagedClusterCodeVersionResult + :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] + :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.ManagedClusterCodeVersionResult], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def get_by_environment( + self, + location: str, + environment: Union[str, _models.ManagedClusterVersionEnvironment], + cluster_version: str, + **kwargs: Any + ) -> _models.ManagedClusterCodeVersionResult: + """Gets information about a Service Fabric cluster code version available for the specified + environment. + + Gets information about an available Service Fabric cluster code version by environment. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param environment: The operating system of the cluster. "Windows" Required. + :type environment: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment + :param cluster_version: The cluster code version. Required. + :type cluster_version: str + :return: ManagedClusterCodeVersionResult. The ManagedClusterCodeVersionResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult + :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_get_by_environment_request( + location=location, + environment=environment, + cluster_version=cluster_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedClusterCodeVersionResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def list_by_environment( + self, location: str, environment: Union[str, _models.ManagedClusterVersionEnvironment], **kwargs: Any + ) -> List[_models.ManagedClusterCodeVersionResult]: + """Gets the list of Service Fabric cluster code versions available for the specified environment. + + Gets all available code versions for Service Fabric cluster resources by environment. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param environment: The operating system of the cluster. "Windows" Required. + :type environment: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment + :return: list of ManagedClusterCodeVersionResult + :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] + :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.ManagedClusterCodeVersionResult], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ManagedUnsupportedVMSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_unsupported_vm_sizes` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, vm_size: str, **kwargs: Any) -> _models.ManagedVMSize: + """Get unsupported vm size for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param vm_size: VM Size name. Required. + :type vm_size: str + :return: ManagedVMSize. The ManagedVMSize is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize + :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.ManagedVMSize] = kwargs.pop("cls", None) + + _request = build_managed_unsupported_vm_sizes_get_request( + location=location, + vm_size=vm_size, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedVMSize, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> AsyncIterable["_models.ManagedVMSize"]: + """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :return: An iterator like instance of ManagedVMSize + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedVMSize]] = 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_managed_unsupported_vm_sizes_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedVMSize], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_clusters` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Get a Service Fabric managed cluster resource created or in the process of being created in the + specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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.ManagedCluster] = kwargs.pop("cls", None) + + _request = build_managed_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedCluster, 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, + cluster_name: str, + parameters: Union[_models.ManagedCluster, 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_managed_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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 ManagedCluster. The ManagedCluster is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. 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 ManagedCluster. The ManagedCluster is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. 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 ManagedCluster. The ManagedCluster is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.ManagedCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. Is one of the following types: ManagedCluster, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster or JSON or + IO[bytes] + :return: An instance of AsyncLROPoller that returns ManagedCluster. The ManagedCluster is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :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.ManagedCluster] = 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, + cluster_name=cluster_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.ManagedCluster, 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.ManagedCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.ManagedCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.ManagedClusterUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. 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: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. 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: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.ManagedClusterUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. Is one of the following types: + ManagedClusterUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters or JSON or + IO[bytes] + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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.ManagedCluster] = 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_managed_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial(self, resource_group_name: str, cluster_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_managed_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Delete a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_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, + cluster_name=cluster_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 + ) -> AsyncIterable["_models.ManagedCluster"]: + """Gets all Service Fabric cluster resources created or in the process of being created in the + 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 ManagedCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedCluster]] = 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_managed_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedCluster], 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.json()) + 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) -> AsyncIterable["_models.ManagedCluster"]: + """Gets all Service Fabric cluster resources created or in the process of being created in the + subscription. + + :return: An iterator like instance of ManagedCluster + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedCluster]] = 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_managed_clusters_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), 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.ManagedCluster], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :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.FaultSimulation] = 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_managed_clusters_get_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FaultSimulation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_fault_simulation( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FaultSimulation"]: + """Gets the list of recent fault simulations for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of FaultSimulation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FaultSimulation]] = 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_managed_clusters_list_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FaultSimulation], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _start_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, 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_managed_clusters_start_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationContentWrapper, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. Is one of the following types: + FaultSimulationContentWrapper, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._start_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, 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_managed_clusters_stop_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._stop_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ManagedAzResiliencyStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_az_resiliency_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any + ) -> _models.ManagedAzResiliencyStatus: + """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric + Managed Clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedAzResiliencyStatus. The ManagedAzResiliencyStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus + :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.ManagedAzResiliencyStatus] = kwargs.pop("cls", None) + + _request = build_managed_az_resiliency_status_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedAzResiliencyStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ManagedApplyMaintenanceWindowOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_apply_maintenance_window` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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 post(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> None: + """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_managed_apply_maintenance_window_post_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ManagedMaintenanceWindowStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_maintenance_window_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any + ) -> _models.ManagedMaintenanceWindowStatus: + """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedMaintenanceWindowStatus. The ManagedMaintenanceWindowStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus + :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.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) + + _request = build_managed_maintenance_window_status_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedMaintenanceWindowStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class NodeTypesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_types` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> _models.NodeType: + """Get a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: NodeType. The NodeType is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType + :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.NodeType] = kwargs.pop("cls", None) + + _request = build_node_types_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NodeType, 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, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeType, 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_node_types_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeType, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType + :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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeType, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. Is one of the following types: NodeType, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :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.NodeType] = 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, + cluster_name=cluster_name, + node_type_name=node_type_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.NodeType, 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.NodeType].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NodeType]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeUpdateParameters, 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_node_types_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters + :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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. Is one of the + following types: NodeTypeUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns NodeType. The NodeType is compatible with + MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :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.NodeType] = 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, + cluster_name=cluster_name, + node_type_name=node_type_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.NodeType, 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.NodeType].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.NodeType]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, cluster_name: str, node_type_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_node_types_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_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, + cluster_name=cluster_name, + node_type_name=node_type_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_managed_clusters( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NodeType"]: + """Gets all Node types of the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of NodeType + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NodeType]] = 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_node_types_list_by_managed_clusters_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.NodeType], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + async def _deallocate_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_deallocate_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._deallocate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _delete_node_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_delete_node_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._delete_node_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _redeploy_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_redeploy_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._redeploy_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_reimage_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._reimage_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_restart_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._restart_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _start_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_start_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + async def _start_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, 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_node_types_start_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationContentWrapper, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. Is one of the following types: + FaultSimulationContentWrapper, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._start_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _stop_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, 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_node_types_stop_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._stop_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :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.FaultSimulation] = 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_node_types_get_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + await response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FaultSimulation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_fault_simulation( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> AsyncIterable["_models.FaultSimulation"]: + """Gets the list of recent fault simulations for the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: An iterator like instance of FaultSimulation + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FaultSimulation]] = 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_node_types_list_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FaultSimulation], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class NodeTypeSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_type_skus` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + input_args.pop(0) if input_args else kwargs.pop("config") + ) + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> AsyncIterable["_models.NodeTypeAvailableSku"]: + """Get a Service Fabric node type supported SKUs. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: An iterator like instance of NodeTypeAvailableSku + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NodeTypeAvailableSku]] = 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_node_type_skus_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.NodeTypeAvailableSku], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_results` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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 _get_initial(self, location: str, operation_id: 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_operation_results_get_request( + location=location, + operation_id=operation_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) + + _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.json()) + 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.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_get(self, location: str, operation_id: str, **kwargs: Any) -> AsyncLROPoller[None]: + """Get long running operation result. + + Get long running operation result. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: operation identifier. Required. + :type operation_id: 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._get_initial( + location=location, + operation_id=operation_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + await raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, operation_id: str, **kwargs: Any) -> _models.LongRunningOperationResult: + """Get long running operation status. + + Get long running operation status. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: operation identifier. Required. + :type operation_id: str + :return: LongRunningOperationResult. The LongRunningOperationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult + :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.LongRunningOperationResult] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + location=location, + operation_id=operation_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LongRunningOperationResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# 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 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py deleted file mode 100644 index 7bd7f401a340..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py +++ /dev/null @@ -1,743 +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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 ...operations._services_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_applications_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.aio.ServiceFabricManagedClustersManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace_async - async def get( - self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, **kwargs: Any - ) -> _models.ServiceResource: - """Gets a Service Fabric managed service resource. - - Get a Service Fabric service resource created or in the process of being created in the Service - Fabric managed application resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceResource", 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, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceResource, 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, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_name: str, - service_name: str, - parameters: _models.ServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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 ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. 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 ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> AsyncLROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. Is either a ServiceResource type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource or IO[bytes] - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :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.ServiceResource] = 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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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("ServiceResource", 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.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: _models.ServiceUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. 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: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. Is either a ServiceUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters or - IO[bytes] - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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.ServiceResource] = 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, "ServiceUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceResource", 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, cluster_name: str, application_name: str, service_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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_name: str, service_name: str, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Service Fabric managed service resource. - - Delete a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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 - def list_by_applications( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> AsyncIterable["_models.ServiceResource"]: - """Gets the list of service resources created in the specified Service Fabric managed application - resource. - - Gets all service resources created or in the process of being created in the Service Fabric - managed application resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :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.ServiceResourceList] = 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_applications_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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("ServiceResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py index 114552fd3c26..82c4b5104f10 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/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,17 +13,17 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore +from ._models import ( # type: ignore AddRemoveIncrementalNamedPartitionScalingMechanism, AdditionalNetworkInterfaceConfiguration, ApplicationHealthPolicy, ApplicationResource, - ApplicationResourceList, + ApplicationResourceProperties, ApplicationTypeResource, - ApplicationTypeResourceList, + ApplicationTypeResourceProperties, ApplicationTypeUpdateParameters, ApplicationTypeVersionResource, - ApplicationTypeVersionResourceList, + ApplicationTypeVersionResourceProperties, ApplicationTypeVersionUpdateParameters, ApplicationTypeVersionsCleanupPolicy, ApplicationUpdateParameters, @@ -39,37 +39,43 @@ ClusterUpgradeDeltaHealthPolicy, ClusterUpgradePolicy, EndpointRangeDescription, - ErrorModel, + ErrorAdditionalInfo, + ErrorDetail, ErrorModelError, + ErrorResponse, + FaultSimulation, + FaultSimulationConstraints, + FaultSimulationContent, + FaultSimulationContentWrapper, + FaultSimulationDetails, + FaultSimulationIdContent, FrontendConfiguration, + IPConfigurationPublicIPAddressConfiguration, IpConfiguration, - IpConfigurationPublicIPAddressConfiguration, IpTag, LoadBalancingRule, LongRunningOperationResult, ManagedAzResiliencyStatus, ManagedCluster, ManagedClusterCodeVersionResult, - ManagedClusterListResult, + ManagedClusterProperties, ManagedClusterUpdateParameters, + ManagedClusterVersionDetails, ManagedIdentity, ManagedMaintenanceWindowStatus, - ManagedProxyResource, ManagedVMSize, - ManagedVMSizesResult, NamedPartitionScheme, NetworkSecurityRule, NodeType, NodeTypeActionParameters, NodeTypeAvailableSku, - NodeTypeListResult, - NodeTypeListSkuResult, + NodeTypeFaultSimulation, NodeTypeNatConfig, + NodeTypeProperties, NodeTypeSku, NodeTypeSkuCapacity, NodeTypeSupportedSku, NodeTypeUpdateParameters, - OperationListResult, OperationResult, Partition, PartitionInstanceCountScaleMechanism, @@ -91,7 +97,6 @@ ServicePlacementRequireDomainDistributionPolicy, ServicePlacementRequiredDomainPolicy, ServiceResource, - ServiceResourceList, ServiceResourceProperties, ServiceResourcePropertiesBase, ServiceTypeHealthPolicy, @@ -105,9 +110,11 @@ SubResource, Subnet, SystemData, + TrackedResource, UniformInt64RangePartitionScheme, UserAssignedIdentity, VMSSExtension, + VMSSExtensionProperties, VMSize, VaultCertificate, VaultSecretGroup, @@ -115,18 +122,22 @@ VmImagePlan, VmManagedIdentity, VmssDataDisk, + ZoneFaultSimulationContent, ) -from ._service_fabric_managed_clusters_management_client_enums import ( # type: ignore +from ._enums import ( # type: ignore Access, AutoGeneratedDomainNameLabelScope, ClusterState, ClusterUpgradeCadence, ClusterUpgradeMode, + CreatedByType, Direction, DiskType, EvictionPolicyType, FailureAction, + FaultKind, + FaultSimulationStatus, IPAddressType, ManagedClusterAddOnFeature, ManagedClusterVersionEnvironment, @@ -144,6 +155,7 @@ Protocol, PublicIPAddressVersion, RollingUpgradeMode, + SecurityEncryptionType, SecurityType, ServiceCorrelationScheme, ServiceKind, @@ -152,9 +164,9 @@ ServicePlacementPolicyType, ServiceScalingMechanismKind, ServiceScalingTriggerKind, + SfmcOperationStatus, SkuName, UpdateType, - UpgradeMode, VmSetupAction, VmssExtensionSetupOrder, ZonalUpdateMode, @@ -168,12 +180,12 @@ "AdditionalNetworkInterfaceConfiguration", "ApplicationHealthPolicy", "ApplicationResource", - "ApplicationResourceList", + "ApplicationResourceProperties", "ApplicationTypeResource", - "ApplicationTypeResourceList", + "ApplicationTypeResourceProperties", "ApplicationTypeUpdateParameters", "ApplicationTypeVersionResource", - "ApplicationTypeVersionResourceList", + "ApplicationTypeVersionResourceProperties", "ApplicationTypeVersionUpdateParameters", "ApplicationTypeVersionsCleanupPolicy", "ApplicationUpdateParameters", @@ -189,37 +201,43 @@ "ClusterUpgradeDeltaHealthPolicy", "ClusterUpgradePolicy", "EndpointRangeDescription", - "ErrorModel", + "ErrorAdditionalInfo", + "ErrorDetail", "ErrorModelError", + "ErrorResponse", + "FaultSimulation", + "FaultSimulationConstraints", + "FaultSimulationContent", + "FaultSimulationContentWrapper", + "FaultSimulationDetails", + "FaultSimulationIdContent", "FrontendConfiguration", + "IPConfigurationPublicIPAddressConfiguration", "IpConfiguration", - "IpConfigurationPublicIPAddressConfiguration", "IpTag", "LoadBalancingRule", "LongRunningOperationResult", "ManagedAzResiliencyStatus", "ManagedCluster", "ManagedClusterCodeVersionResult", - "ManagedClusterListResult", + "ManagedClusterProperties", "ManagedClusterUpdateParameters", + "ManagedClusterVersionDetails", "ManagedIdentity", "ManagedMaintenanceWindowStatus", - "ManagedProxyResource", "ManagedVMSize", - "ManagedVMSizesResult", "NamedPartitionScheme", "NetworkSecurityRule", "NodeType", "NodeTypeActionParameters", "NodeTypeAvailableSku", - "NodeTypeListResult", - "NodeTypeListSkuResult", + "NodeTypeFaultSimulation", "NodeTypeNatConfig", + "NodeTypeProperties", "NodeTypeSku", "NodeTypeSkuCapacity", "NodeTypeSupportedSku", "NodeTypeUpdateParameters", - "OperationListResult", "OperationResult", "Partition", "PartitionInstanceCountScaleMechanism", @@ -241,7 +259,6 @@ "ServicePlacementRequireDomainDistributionPolicy", "ServicePlacementRequiredDomainPolicy", "ServiceResource", - "ServiceResourceList", "ServiceResourceProperties", "ServiceResourcePropertiesBase", "ServiceTypeHealthPolicy", @@ -255,9 +272,11 @@ "SubResource", "Subnet", "SystemData", + "TrackedResource", "UniformInt64RangePartitionScheme", "UserAssignedIdentity", "VMSSExtension", + "VMSSExtensionProperties", "VMSize", "VaultCertificate", "VaultSecretGroup", @@ -265,15 +284,19 @@ "VmImagePlan", "VmManagedIdentity", "VmssDataDisk", + "ZoneFaultSimulationContent", "Access", "AutoGeneratedDomainNameLabelScope", "ClusterState", "ClusterUpgradeCadence", "ClusterUpgradeMode", + "CreatedByType", "Direction", "DiskType", "EvictionPolicyType", "FailureAction", + "FaultKind", + "FaultSimulationStatus", "IPAddressType", "ManagedClusterAddOnFeature", "ManagedClusterVersionEnvironment", @@ -291,6 +314,7 @@ "Protocol", "PublicIPAddressVersion", "RollingUpgradeMode", + "SecurityEncryptionType", "SecurityType", "ServiceCorrelationScheme", "ServiceKind", @@ -299,9 +323,9 @@ "ServicePlacementPolicyType", "ServiceScalingMechanismKind", "ServiceScalingTriggerKind", + "SfmcOperationStatus", "SkuName", "UpdateType", - "UpgradeMode", "VmSetupAction", "VmssExtensionSetupOrder", "ZonalUpdateMode", diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_enums.py similarity index 75% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_enums.py index 3598ad19202c..ef39d66983ec 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/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. # -------------------------------------------------------------------------- @@ -14,14 +14,16 @@ class Access(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The network traffic is allowed or denied.""" ALLOW = "allow" + """The network traffic is allowed.""" DENY = "deny" + """The network traffic is denied.""" class AutoGeneratedDomainNameLabelScope(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This enum is the entrypoint to using a certificate from a public CA for your cluster. This property was introduced to solve the domain squatting problem with new domains. A domain name will be generated in the following - format: :code:``.:code:``.:code:``.:code:``. + format: {clustername}.{hash}.{regionname}.sfmcdomain. The hash portion comes from Azure DNS' Deterministic Name Library. The library creates a hash using the cluster's Tenant, Subscription, Resource Group and Resource Name using the AutoGeneratedDomainNameLabelScope/reuse policy chosen. @@ -89,16 +91,32 @@ class ClusterUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource.""" +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """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 Direction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network security rule direction.""" INBOUND = "inbound" + """Inbound direction.""" OUTBOUND = "outbound" + """Outbound direction.""" class DiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Managed data disk type. IOPS and throughput are given by the disk size, to see more information - go to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types. + go to `https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types + `_. """ STANDARD_LRS = "Standard_LRS" @@ -108,6 +126,15 @@ class DiskType(str, Enum, metaclass=CaseInsensitiveEnumMeta): applications and dev/test.""" PREMIUM_LRS = "Premium_LRS" """Premium SSD locally redundant storage. Best for production and performance sensitive workloads.""" + PREMIUM_V2_LRS = "PremiumV2_LRS" + """Premium SSD V2 locally redundant storage. Best for production and performance sensitive + workloads that consistently require low latency and high IOPS and throughput.""" + STANDARD_SSD_ZRS = "StandardSSD_ZRS" + """Standard SSD zone redundant storage. Best for web servers, lightly used enterprise applications + and dev/test that need storage resiliency against zone failures.""" + PREMIUM_ZRS = "Premium_ZRS" + """Premium SSD zone redundant storage. Best for production workloads that need storage resiliency + against zone failures.""" class EvictionPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -121,15 +148,47 @@ class EvictionPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): class FailureAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The compensating action to perform when a Monitored upgrade encounters monitoring policy or - health policy violations. - Rollback specifies that the upgrade will start rolling back automatically. - Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode. + health policy violations. Invalid indicates the failure action is invalid. Rollback specifies + that the upgrade will start rolling back automatically. Manual indicates that the upgrade will + switch to UnmonitoredManual upgrade mode. """ ROLLBACK = "Rollback" - """The upgrade will start rolling back automatically. The value is 0""" + """Indicates that a rollback of the upgrade will be performed by Service Fabric if the upgrade + fails.""" MANUAL = "Manual" - """The upgrade will switch to UnmonitoredManual upgrade mode. The value is 1""" + """Indicates that a manual repair will need to be performed by the administrator if the upgrade + fails. Service Fabric will not proceed to the next upgrade domain automatically.""" + + +class FaultKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of fault simulation.""" + + ZONE = "Zone" + """Simulates an availability zone down.""" + + +class FaultSimulationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Fault simulation status.""" + + STARTING = "Starting" + """Indicates the fault simulation is starting. The simulation will have this status while the + start operation is in progress.""" + ACTIVE = "Active" + """Indicates the fault simulation is active. The simulation will have this status after the start + operation has completed successfully.""" + STOPPING = "Stopping" + """Indicates the fault simulation is stopping. The simulation will have this status while the stop + operation is in progress.""" + DONE = "Done" + """Indicates the fault simulation is done. The simulation will have this status after the stop + operation has completed successfully.""" + START_FAILED = "StartFailed" + """Indicates the fault simulation has failed on start. The simulation will have this status after + the start operation fails.""" + STOP_FAILED = "StopFailed" + """Indicates the fault simulation has failed on stop. The simulation will have this status after + the stop operation fails.""" class IPAddressType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -153,10 +212,10 @@ class ManagedClusterAddOnFeature(str, Enum, metaclass=CaseInsensitiveEnumMeta): class ManagedClusterVersionEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """ManagedClusterVersionEnvironment.""" + """The operating system of the cluster. The default means all.""" WINDOWS = "Windows" - """Windows.""" + """Indicates os is Windows.""" class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -177,15 +236,25 @@ class ManagedResourceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumM """The provisioning state of the managed resource.""" NONE = "None" + """The resource does not have a provisioning state.""" CREATING = "Creating" + """The resource is being created.""" CREATED = "Created" + """The resource is created.""" UPDATING = "Updating" + """The resource is being updated.""" SUCCEEDED = "Succeeded" + """The resource provisioning has succeeded.""" FAILED = "Failed" + """The resource provisioning has failed.""" CANCELED = "Canceled" + """The resource provisioning has been canceled.""" DELETING = "Deleting" + """The resource is being deleted.""" DELETED = "Deleted" + """The resource has been deleted.""" OTHER = "Other" + """The resource provisioning state is a state other than the previously specified states.""" class MoveCost(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -216,12 +285,19 @@ class NsgProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Network protocol this rule applies to.""" HTTP = "http" + """Protocol applies to HTTP.""" HTTPS = "https" + """Protocol applies to HTTPS.""" TCP = "tcp" + """Protocol applies to TCP.""" UDP = "udp" + """Protocol applies to UDP.""" ICMP = "icmp" + """Protocol applies to ICMP.""" AH = "ah" + """Protocol applies to AH.""" ESP = "esp" + """Protocol applies to ESP.""" class OsType(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -249,43 +325,56 @@ class PrivateEndpointNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMet """Enable or Disable apply network policies on private end point in the subnet.""" ENABLED = "enabled" + """Enable apply network policies on private end point in the subnet.""" DISABLED = "disabled" + """Disable apply network policies on private end point in the subnet.""" class PrivateIPAddressVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies whether the IP configuration's private IP is IPv4 or IPv6. Default is IPv4.""" I_PV4 = "IPv4" + """The IP configuration's private IP is IPv4.""" I_PV6 = "IPv6" + """The IP configuration's private IP is IPv6.""" class PrivateLinkServiceNetworkPolicies(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enable or Disable apply network policies on private link service in the subnet.""" ENABLED = "enabled" + """Enable apply network policies on private link service in the subnet.""" DISABLED = "disabled" + """Disable apply network policies on private link service in the subnet.""" class ProbeProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the reference to the load balancer probe used by the load balancing rule.""" + """The reference to the load balancer probe used by the load balancing rule.""" TCP = "tcp" + """Probe protocol is TCP.""" HTTP = "http" + """Probe protocol is HTTP.""" HTTPS = "https" + """Probe protocol is HTTPS.""" class Protocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reference to the transport protocol used by the load balancing rule.""" TCP = "tcp" + """Transport protocol is TCP.""" UDP = "udp" + """Transport protocol is UDP.""" class PublicIPAddressVersion(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies whether the IP configuration's public IP is IPv4 or IPv6. Default is IPv4.""" I_PV4 = "IPv4" + """The IP configuration's public IP is IPv4.""" I_PV6 = "IPv6" + """The IP configuration's public IP is IPv6.""" class RollingUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -301,6 +390,17 @@ class RollingUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): 1.""" +class SecurityEncryptionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Specifies the securityEncryptionType type of the nodeType. Only DiskWithVMGuestState and + VMGuestStateOnly are currently supported. + """ + + DISK_WITH_VM_GUEST_STATE = "DiskWithVMGuestState" + """For encryption of the managed disk along with VMGuestState blob.""" + VM_GUEST_STATE_ONLY = "VMGuestStateOnly" + """For encryption of just the VMGuestState blob.""" + + class SecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the security type of the nodeType. Only Standard and TrustedLaunch are currently supported. @@ -310,6 +410,9 @@ class SecurityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Trusted Launch is a security type that secures generation 2 virtual machines.""" STANDARD = "Standard" """Standard is the default security type for all machines.""" + CONFIDENTIAL_VM = "ConfidentialVM" + """ConfidentialVM provides hardware-based encryption, trusted execution environment (TEE) and + isolation of the VM memory & CPU from host.""" class ServiceCorrelationScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): @@ -409,6 +512,23 @@ class ServiceScalingTriggerKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): value is 1.""" +class SfmcOperationStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Sfmc operation status.""" + + CREATED = "Created" + """Operation created.""" + STARTED = "Started" + """Operation started.""" + SUCCEEDED = "Succeeded" + """Operation succeeded.""" + FAILED = "Failed" + """Operation failed.""" + ABORTED = "Aborted" + """Operation aborted.""" + CANCELED = "Canceled" + """Operation canceled.""" + + class SkuName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Sku Name.""" @@ -428,21 +548,6 @@ class UpdateType(str, Enum, metaclass=CaseInsensitiveEnumMeta): continue.""" -class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The mode used to monitor health during a rolling upgrade. The values are UnmonitoredAuto, - UnmonitoredManual, Monitored, and UnmonitoredDeferred. - """ - - UNMONITORED_AUTO = "UnmonitoredAuto" - """The upgrade will proceed automatically without performing any health monitoring. The value is 0""" - UNMONITORED_MANUAL = "UnmonitoredManual" - """The upgrade will stop after completing each upgrade domain, giving the opportunity to manually - monitor health before proceeding. The value is 1""" - MONITORED = "Monitored" - """The upgrade will stop after completing each upgrade domain and automatically monitor health - before proceeding. The value is 2""" - - class VmSetupAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """action to be performed on the vms before bootstrapping the service fabric runtime.""" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py index 859d83e7fee3..7bb5e9c1a6fd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py @@ -1,1008 +1,2495 @@ +# 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. # -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation -from azure.core.exceptions import HttpResponseError -import msrest.serialization +import datetime +from typing import Any, Dict, List, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload +from .._utils.model_base import Model as _Model, rest_discriminator, rest_field +from ._enums import ( + FaultKind, + PartitionScheme, + ServiceKind, + ServicePlacementPolicyType, + ServiceScalingMechanismKind, + ServiceScalingTriggerKind, +) -class ScalingMechanism(msrest.serialization.Model): - """Describes the mechanism for performing a scaling operation. +if TYPE_CHECKING: + from .. import models as _models - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AddRemoveIncrementalNamedPartitionScalingMechanism, PartitionInstanceCountScaleMechanism. - All required parameters must be populated in order to send to Azure. +class AdditionalNetworkInterfaceConfiguration(_Model): + """Specifies the settings for a network interface to attach to the node type. - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", - "AddRemoveIncrementalNamedPartition". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :vartype enable_accelerated_networking: bool + :ivar dscp_configuration: Specifies the DSCP configuration to apply to the network interface. + :vartype dscp_configuration: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :ivar ip_configurations: Specifies the IP configurations of the network interface. Required. + :vartype ip_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration] """ - _validation = { - "kind": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - } - - _subtype_map = { - "kind": { - "AddRemoveIncrementalNamedPartition": "AddRemoveIncrementalNamedPartitionScalingMechanism", - "ScalePartitionInstanceCount": "PartitionInstanceCountScaleMechanism", - } - } - - def __init__(self, **kwargs): - super(ScalingMechanism, self).__init__(**kwargs) - self.kind = None # type: Optional[str] + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the network interface. Required.""" + enable_accelerated_networking: Optional[bool] = rest_field( + name="enableAcceleratedNetworking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is accelerated networking-enabled.""" + dscp_configuration: Optional["_models.SubResource"] = rest_field( + name="dscpConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the DSCP configuration to apply to the network interface.""" + ip_configurations: List["_models.IpConfiguration"] = rest_field( + name="ipConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the IP configurations of the network interface. Required.""" + + @overload + def __init__( + self, + *, + name: str, + ip_configurations: List["_models.IpConfiguration"], + enable_accelerated_networking: Optional[bool] = None, + dscp_configuration: Optional["_models.SubResource"] = 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 ScalingMechanism(_Model): + """Describes the mechanism for performing a scaling operation. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AddRemoveIncrementalNamedPartitionScalingMechanism, PartitionInstanceCountScaleMechanism -class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): - """Represents a scaling mechanism for adding or removing named partitions of a stateless service. Partition names are in the format '0','1'...'N-1'. + :ivar kind: Required. Known values are: "ScalePartitionInstanceCount" and + "AddRemoveIncrementalNamedPartition". + :vartype kind: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind + """ - All required parameters must be populated in order to send to Azure. + __mapping__: Dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"ScalePartitionInstanceCount\" and + \"AddRemoveIncrementalNamedPartition\".""" + + @overload + def __init__( + self, + *, + kind: 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 AddRemoveIncrementalNamedPartitionScalingMechanism( + ScalingMechanism, discriminator="AddRemoveIncrementalNamedPartition" +): # pylint: disable=name-too-long + """Represents a scaling mechanism for adding or removing named partitions of a stateless service. + Partition names are in the format '0','1'...'N-1'. + + :ivar min_partition_count: Minimum number of named partitions of the service. Required. + :vartype min_partition_count: int + :ivar max_partition_count: Maximum number of named partitions of the service. Required. + :vartype max_partition_count: int + :ivar scale_increment: The number of instances to add or remove during a scaling operation. + Required. + :vartype scale_increment: int + :ivar kind: Specifies the mechanism associated with this scaling policy. Required. Represents a + scaling mechanism for adding or removing named partitions of a stateless service. The value is + 1. + :vartype kind: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ADD_REMOVE_INCREMENTAL_NAMED_PARTITION + """ - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", - "AddRemoveIncrementalNamedPartition". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind - :param min_partition_count: Required. Minimum number of named partitions of the service. - :type min_partition_count: int - :param max_partition_count: Required. Maximum number of named partitions of the service. - :type max_partition_count: int - :param scale_increment: Required. The number of instances to add or remove during a scaling - operation. - :type scale_increment: int - """ - - _validation = { - "kind": {"required": True}, - "min_partition_count": {"required": True}, - "max_partition_count": {"required": True}, - "scale_increment": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "min_partition_count": {"key": "minPartitionCount", "type": "int"}, - "max_partition_count": {"key": "maxPartitionCount", "type": "int"}, - "scale_increment": {"key": "scaleIncrement", "type": "int"}, - } - - def __init__(self, **kwargs): - super(AddRemoveIncrementalNamedPartitionScalingMechanism, self).__init__(**kwargs) - self.kind = "AddRemoveIncrementalNamedPartition" # type: str - self.min_partition_count = kwargs["min_partition_count"] - self.max_partition_count = kwargs["max_partition_count"] - self.scale_increment = kwargs["scale_increment"] - - -class ApplicationHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children entities. - - All required parameters must be populated in order to send to Azure. - - :param consider_warning_as_error: Required. Indicates whether warnings are treated with the - same severity as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: Required. The maximum allowed percentage of - unhealthy deployed applications. Allowed values are Byte values from zero to 100. - The percentage represents the maximum tolerated percentage of deployed applications that can - be unhealthy before the application is considered in error. - This is calculated by dividing the number of unhealthy deployed applications over the number - of nodes where the application is currently deployed on in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - :type max_percent_unhealthy_deployed_applications: int - :param default_service_type_health_policy: The health policy used by default to evaluate the + min_partition_count: int = rest_field( + name="minPartitionCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Minimum number of named partitions of the service. Required.""" + max_partition_count: int = rest_field( + name="maxPartitionCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Maximum number of named partitions of the service. Required.""" + scale_increment: int = rest_field(name="scaleIncrement", visibility=["read", "create", "update", "delete", "query"]) + """The number of instances to add or remove during a scaling operation. Required.""" + kind: Literal[ServiceScalingMechanismKind.ADD_REMOVE_INCREMENTAL_NAMED_PARTITION] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the mechanism associated with this scaling policy. Required. Represents a scaling + mechanism for adding or removing named partitions of a stateless service. The value is 1.""" + + @overload + def __init__( + self, + *, + min_partition_count: int, + max_partition_count: int, + scale_increment: int, + ) -> 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, kind=ServiceScalingMechanismKind.ADD_REMOVE_INCREMENTAL_NAMED_PARTITION, **kwargs) + + +class ApplicationHealthPolicy(_Model): + """Defines a health policy used to evaluate the health of an application or one of its children + entities. + + :ivar consider_warning_as_error: Indicates whether warnings are treated with the same severity + as errors. Required. + :vartype consider_warning_as_error: bool + :ivar max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy + deployed applications. Allowed values are Byte values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can be + unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number of + nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage + is zero. Required. + :vartype max_percent_unhealthy_deployed_applications: int + :ivar default_service_type_health_policy: The health policy used by default to evaluate the health of a service type. - :type default_service_type_health_policy: - ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy - :param service_type_health_policy_map: The map with service type health policy per service type + :vartype default_service_type_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy + :ivar service_type_health_policy_map: The map with service type health policy per service type name. The map is empty by default. - :type service_type_health_policy_map: dict[str, - ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy] + :vartype service_type_health_policy_map: dict[str, + ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy] """ - _validation = { - "consider_warning_as_error": {"required": True}, - "max_percent_unhealthy_deployed_applications": {"required": True}, - } - - _attribute_map = { - "consider_warning_as_error": {"key": "considerWarningAsError", "type": "bool"}, - "max_percent_unhealthy_deployed_applications": { - "key": "maxPercentUnhealthyDeployedApplications", - "type": "int", - }, - "default_service_type_health_policy": { - "key": "defaultServiceTypeHealthPolicy", - "type": "ServiceTypeHealthPolicy", - }, - "service_type_health_policy_map": {"key": "serviceTypeHealthPolicyMap", "type": "{ServiceTypeHealthPolicy}"}, - } - - def __init__(self, **kwargs): - super(ApplicationHealthPolicy, self).__init__(**kwargs) - self.consider_warning_as_error = kwargs["consider_warning_as_error"] - self.max_percent_unhealthy_deployed_applications = kwargs["max_percent_unhealthy_deployed_applications"] - self.default_service_type_health_policy = kwargs.get("default_service_type_health_policy", None) - self.service_type_health_policy_map = kwargs.get("service_type_health_policy_map", None) + consider_warning_as_error: bool = rest_field( + name="considerWarningAsError", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether warnings are treated with the same severity as errors. Required.""" + max_percent_unhealthy_deployed_applications: int = rest_field( + name="maxPercentUnhealthyDeployedApplications", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte + values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can be + unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number of + nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage + is zero. Required.""" + default_service_type_health_policy: Optional["_models.ServiceTypeHealthPolicy"] = rest_field( + name="defaultServiceTypeHealthPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The health policy used by default to evaluate the health of a service type.""" + service_type_health_policy_map: Optional[Dict[str, "_models.ServiceTypeHealthPolicy"]] = rest_field( + name="serviceTypeHealthPolicyMap", visibility=["read", "create", "update", "delete", "query"] + ) + """The map with service type health policy per service type name. The map is empty by default.""" + + @overload + def __init__( + self, + *, + consider_warning_as_error: bool, + max_percent_unhealthy_deployed_applications: int, + default_service_type_health_policy: Optional["_models.ServiceTypeHealthPolicy"] = None, + service_type_health_policy_map: Optional[Dict[str, "_models.ServiceTypeHealthPolicy"]] = 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.servicefabricmanagedclusters.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(msrest.serialization.Model): - """The resource model definition for proxy-only resource. - Variables are only populated by the server, and will be ignored when sending a request. +class ProxyResource(Resource): + """Proxy Resource. - :ivar id: Azure resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.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"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get("location", None) - self.tags = kwargs.get("tags", None) - self.system_data = None + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + """ class ApplicationResource(ProxyResource): """The application resource. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar properties: The application resource properties. + :vartype properties: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResourceProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar identity: Describes the managed identities for an Azure resource. + :vartype identity: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentity + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + properties: Optional["_models.ApplicationResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The application resource properties.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + identity: Optional["_models.ManagedIdentity"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the managed identities for an Azure resource.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + __flattened_items = ["provisioning_state", "version", "parameters", "upgrade_policy", "managed_identities"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ApplicationResourceProperties"] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["_models.ManagedIdentity"] = None, + location: 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: + _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 ApplicationResourceProperties(_Model): + """The application resource properties. + :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param version: The version of the application type as defined in the application manifest. + :ivar version: The version of the application type as defined in the application manifest. This name must be the full Arm Resource ID for the referenced application type version. - :type version: str - :param parameters: List of application parameters with overridden values from their default + :vartype version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: - ~service_fabric_managed_clusters_management_client.models.ApplicationUpgradePolicy - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpgradePolicy + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: - list[~service_fabric_managed_clusters_management_client.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "ManagedIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "upgrade_policy": {"key": "properties.upgradePolicy", "type": "ApplicationUpgradePolicy"}, - "managed_identities": {"key": "properties.managedIdentities", "type": "[ApplicationUserAssignedIdentity]"}, - } - - def __init__(self, **kwargs): - super(ApplicationResource, self).__init__(**kwargs) - self.identity = kwargs.get("identity", None) - self.provisioning_state = None - self.version = kwargs.get("version", None) - self.parameters = kwargs.get("parameters", None) - self.upgrade_policy = kwargs.get("upgrade_policy", None) - self.managed_identities = kwargs.get("managed_identities", None) - - -class ApplicationResourceList(msrest.serialization.Model): - """The list of application resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: - list[~service_fabric_managed_clusters_management_client.models.ApplicationResource] - :ivar next_link: URL to get the next set of application list results if there are any. - :vartype next_link: str + :vartype managed_identities: + list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUserAssignedIdentity] """ - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ApplicationResourceList, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = None + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The current deployment or provisioning state, which only appears in the response.""" + version: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The version of the application type as defined in the application manifest. + This name must be the full Arm Resource ID for the referenced application type version.""" + parameters: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of application parameters with overridden values from their default values specified in + the application manifest.""" + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = rest_field( + name="upgradePolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the policy for a monitored application upgrade.""" + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = rest_field( + name="managedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """List of user assigned identities for the application, each mapped to a friendly name.""" + + @overload + def __init__( + self, + *, + version: Optional[str] = None, + parameters: Optional[Dict[str, str]] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = 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 ApplicationTypeResource(ProxyResource): """The application type name resource. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar properties: The application type name properties. + :vartype properties: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResourceProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + properties: Optional["_models.ApplicationTypeResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The application type name properties.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + __flattened_items = ["provisioning_state"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ApplicationTypeResourceProperties"] = None, + tags: Optional[Dict[str, str]] = None, + location: 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: + _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 ApplicationTypeResourceProperties(_Model): + """The application type name properties. + :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str """ - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The current deployment or provisioning state, which only appears in the response.""" - def __init__(self, **kwargs): - super(ApplicationTypeResource, self).__init__(**kwargs) - self.provisioning_state = None +class ApplicationTypeUpdateParameters(_Model): + """Application type update request. -class ApplicationTypeResourceList(msrest.serialization.Model): - """The list of application type names. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: - list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource] - :ivar next_link: URL to get the next set of application type list results if there are any. - :vartype next_link: str + :ivar tags: Application type update parameters. + :vartype tags: dict[str, str] """ - _validation = { - "next_link": {"readonly": True}, - } + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Application type update parameters.""" - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationTypeResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... - def __init__(self, **kwargs): - super(ApplicationTypeResourceList, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = None + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - -class ApplicationTypeUpdateParameters(msrest.serialization.Model): - """Application type update request. - - :param tags: A set of tags. Application type update parameters. - :type tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, **kwargs): - super(ApplicationTypeUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", None) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) class ApplicationTypeVersionResource(ProxyResource): """An application type version resource for the specified application type name resource. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar properties: The properties of the application type version resource. + :vartype properties: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResourceProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str + """ + + properties: Optional["_models.ApplicationTypeVersionResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The properties of the application type version resource.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + __flattened_items = ["provisioning_state", "app_package_url"] + + @overload + def __init__( + self, + *, + properties: Optional["_models.ApplicationTypeVersionResourceProperties"] = None, + tags: Optional[Dict[str, str]] = None, + location: 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: + _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 ApplicationTypeVersionResourceProperties(_Model): + """The properties of the application type version resource. + :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param app_package_url: The URL to the application package. - :type app_package_url: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "app_package_url": {"key": "properties.appPackageUrl", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ApplicationTypeVersionResource, self).__init__(**kwargs) - self.provisioning_state = None - self.app_package_url = kwargs.get("app_package_url", None) - - -class ApplicationTypeVersionResourceList(msrest.serialization.Model): - """The list of application type version resources for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: - list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] - :ivar next_link: URL to get the next set of application type version list results if there are - any. - :vartype next_link: str + :ivar app_package_url: The URL to the application package. Required. + :vartype app_package_url: str """ - _validation = { - "next_link": {"readonly": True}, - } + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The current deployment or provisioning state, which only appears in the response.""" + app_package_url: str = rest_field(name="appPackageUrl", visibility=["read", "create", "update", "delete", "query"]) + """The URL to the application package. Required.""" - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationTypeVersionResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } + @overload + def __init__( + self, + *, + app_package_url: str, + ) -> None: ... - def __init__(self, **kwargs): - super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = 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 ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): - """The policy used to clean up unused versions. When the policy is not specified explicitly, the default unused application versions to keep will be 3. - All required parameters must be populated in order to send to Azure. +class ApplicationTypeVersionsCleanupPolicy(_Model): + """The policy used to clean up unused versions. When the policy is not specified explicitly, the + default unused application versions to keep will be 3. - :param max_unused_versions_to_keep: Required. Number of unused versions per application type to - keep. - :type max_unused_versions_to_keep: int + :ivar max_unused_versions_to_keep: Number of unused versions per application type to keep. + Required. + :vartype max_unused_versions_to_keep: int """ - _validation = { - "max_unused_versions_to_keep": {"required": True, "minimum": 0}, - } + max_unused_versions_to_keep: int = rest_field( + name="maxUnusedVersionsToKeep", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of unused versions per application type to keep. Required.""" + + @overload + def __init__( + self, + *, + max_unused_versions_to_keep: int, + ) -> None: ... - _attribute_map = { - "max_unused_versions_to_keep": {"key": "maxUnusedVersionsToKeep", "type": "int"}, - } + @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, **kwargs): - super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) - self.max_unused_versions_to_keep = kwargs["max_unused_versions_to_keep"] + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class ApplicationTypeVersionUpdateParameters(msrest.serialization.Model): +class ApplicationTypeVersionUpdateParameters(_Model): """Application type version update request. - :param tags: A set of tags. Application type version update parameters. - :type tags: dict[str, str] + :ivar tags: Application type version update parameters. + :vartype tags: dict[str, str] """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Application type version update parameters.""" - def __init__(self, **kwargs): - super(ApplicationTypeVersionUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", None) + @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] + """ -class ApplicationUpdateParameters(msrest.serialization.Model): + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ApplicationUpdateParameters(_Model): """Application update request. - :param tags: A set of tags. Application update parameters. - :type tags: dict[str, str] + :ivar tags: Application update parameters. + :vartype tags: dict[str, str] """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Application update parameters.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... - def __init__(self, **kwargs): - super(ApplicationUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", 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 ApplicationUpgradePolicy(msrest.serialization.Model): + +class ApplicationUpgradePolicy(_Model): """Describes the policy for a monitored application upgrade. - :param application_health_policy: Defines a health policy used to evaluate the health of an + :ivar application_health_policy: Defines a health policy used to evaluate the health of an application or one of its children entities. - :type application_health_policy: - ~service_fabric_managed_clusters_management_client.models.ApplicationHealthPolicy - :param force_restart: If true, then processes are forcefully restarted during upgrade even when + :vartype application_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationHealthPolicy + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param rolling_upgrade_monitoring_policy: The policy used for monitoring the application + :vartype force_restart: bool + :ivar rolling_upgrade_monitoring_policy: The policy used for monitoring the application upgrade. - :type rolling_upgrade_monitoring_policy: - ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMonitoringPolicy - :param instance_close_delay_duration: Duration in seconds, to wait before a stateless instance + :vartype rolling_upgrade_monitoring_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMonitoringPolicy + :ivar instance_close_delay_duration: Duration in seconds, to wait before a stateless instance is closed, to allow the active requests to drain gracefully. This would be effective when the instance is closing during the application/cluster upgrade, only for those instances which have a non-zero delay duration configured in the service description. - :type instance_close_delay_duration: long - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". - :type upgrade_mode: str or - ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMode - :param upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an + :vartype instance_close_delay_duration: int + :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + Monitored, and UnmonitoredAuto. Known values are: "Monitored" and "UnmonitoredAuto". + :vartype upgrade_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode + :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 - and 42949672925 inclusive. (unsigned 32-bit integer). - :type upgrade_replica_set_check_timeout: long - :param recreate_application: Determines whether the application should be recreated on update. + and 42949672925 inclusive. (unsigned 32-bit integer). Unit is in seconds. + :vartype upgrade_replica_set_check_timeout: int + :ivar recreate_application: Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed. - :type recreate_application: bool + :vartype recreate_application: bool + """ + + application_health_policy: Optional["_models.ApplicationHealthPolicy"] = rest_field( + name="applicationHealthPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Defines a health policy used to evaluate the health of an application or one of its children + entities.""" + force_restart: Optional[bool] = rest_field( + name="forceRestart", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, then processes are forcefully restarted during upgrade even when the code version has + not changed (the upgrade only changes configuration or data).""" + rolling_upgrade_monitoring_policy: Optional["_models.RollingUpgradeMonitoringPolicy"] = rest_field( + name="rollingUpgradeMonitoringPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy used for monitoring the application upgrade.""" + instance_close_delay_duration: Optional[int] = rest_field( + name="instanceCloseDelayDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """Duration in seconds, to wait before a stateless instance is closed, to allow the active + requests to drain gracefully. This would be effective when the instance is closing during the + application/cluster upgrade, only for those instances which have a non-zero delay duration + configured in the service description.""" + upgrade_mode: Optional[Union[str, "_models.RollingUpgradeMode"]] = rest_field( + name="upgradeMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The mode used to monitor health during a rolling upgrade. The values are Monitored, and + UnmonitoredAuto. Known values are: \"Monitored\" and \"UnmonitoredAuto\".""" + upgrade_replica_set_check_timeout: Optional[int] = rest_field( + name="upgradeReplicaSetCheckTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum amount of time to block processing of an upgrade domain and prevent loss of + availability when there are unexpected issues. When this timeout expires, processing of the + upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the + start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned + 32-bit integer). Unit is in seconds.""" + recreate_application: Optional[bool] = rest_field( + name="recreateApplication", visibility=["read", "create", "update", "delete", "query"] + ) + """Determines whether the application should be recreated on update. If value=true, the rest of + the upgrade policy parameters are not allowed.""" + + @overload + def __init__( + self, + *, + application_health_policy: Optional["_models.ApplicationHealthPolicy"] = None, + force_restart: Optional[bool] = None, + rolling_upgrade_monitoring_policy: Optional["_models.RollingUpgradeMonitoringPolicy"] = None, + instance_close_delay_duration: Optional[int] = None, + upgrade_mode: Optional[Union[str, "_models.RollingUpgradeMode"]] = None, + upgrade_replica_set_check_timeout: Optional[int] = None, + recreate_application: 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 ApplicationUserAssignedIdentity(_Model): + """User assigned identity for the application. + + :ivar name: The friendly name of user assigned identity. Required. + :vartype name: str + :ivar principal_id: The principal id of user assigned identity. Required. + :vartype principal_id: str """ - _attribute_map = { - "application_health_policy": {"key": "applicationHealthPolicy", "type": "ApplicationHealthPolicy"}, - "force_restart": {"key": "forceRestart", "type": "bool"}, - "rolling_upgrade_monitoring_policy": { - "key": "rollingUpgradeMonitoringPolicy", - "type": "RollingUpgradeMonitoringPolicy", - }, - "instance_close_delay_duration": {"key": "instanceCloseDelayDuration", "type": "long"}, - "upgrade_mode": {"key": "upgradeMode", "type": "str"}, - "upgrade_replica_set_check_timeout": {"key": "upgradeReplicaSetCheckTimeout", "type": "long"}, - "recreate_application": {"key": "recreateApplication", "type": "bool"}, - } + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The friendly name of user assigned identity. Required.""" + principal_id: str = rest_field(name="principalId", visibility=["read", "create", "update", "delete", "query"]) + """The principal id of user assigned identity. Required.""" - def __init__(self, **kwargs): - super(ApplicationUpgradePolicy, self).__init__(**kwargs) - self.application_health_policy = kwargs.get("application_health_policy", None) - self.force_restart = kwargs.get("force_restart", False) - self.rolling_upgrade_monitoring_policy = kwargs.get("rolling_upgrade_monitoring_policy", None) - self.instance_close_delay_duration = kwargs.get("instance_close_delay_duration", None) - self.upgrade_mode = kwargs.get("upgrade_mode", None) - self.upgrade_replica_set_check_timeout = kwargs.get("upgrade_replica_set_check_timeout", None) - self.recreate_application = kwargs.get("recreate_application", None) + @overload + def __init__( + self, + *, + name: str, + principal_id: str, + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class ApplicationUserAssignedIdentity(msrest.serialization.Model): - """ApplicationUserAssignedIdentity. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - All required parameters must be populated in order to send to Azure. - :param name: Required. The friendly name of user assigned identity. - :type name: str - :param principal_id: Required. The principal id of user assigned identity. - :type principal_id: str +class AvailableOperationDisplay(_Model): + """Operation supported by the Service Fabric resource provider. + + :ivar provider: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str """ - _validation = { - "name": {"required": True}, - "principal_id": {"required": True}, - } + provider: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the provider.""" + resource: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The resource on which the operation is performed.""" + operation: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operation that can be performed.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Operation description.""" + + @overload + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScalingTrigger(_Model): + """Describes the trigger for performing a scaling operation. - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - } + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + AveragePartitionLoadScalingTrigger, AverageServiceLoadScalingTrigger - def __init__(self, **kwargs): - super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) - self.name = kwargs["name"] - self.principal_id = kwargs["principal_id"] + :ivar kind: Required. Known values are: "AveragePartitionLoadTrigger" and + "AverageServiceLoadTrigger". + :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind + """ + __mapping__: Dict[str, _Model] = {} + kind: str = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"AveragePartitionLoadTrigger\" and \"AverageServiceLoadTrigger\".""" + + @overload + def __init__( + self, + *, + kind: 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 AvailableOperationDisplay(msrest.serialization.Model): - """Operation supported by the Service Fabric resource provider. - :param provider: The name of the provider. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that can be performed. - :type operation: str - :param description: Operation description. - :type description: str +class AveragePartitionLoadScalingTrigger(ScalingTrigger, discriminator="AveragePartitionLoadTrigger"): + """Represents a scaling trigger related to an average load of a metric/resource of a partition. + + :ivar metric_name: The name of the metric for which usage should be tracked. Required. + :vartype metric_name: str + :ivar lower_load_threshold: The lower limit of the load below which a scale in operation should + be performed. Required. + :vartype lower_load_threshold: float + :ivar upper_load_threshold: The upper limit of the load beyond which a scale out operation + should be performed. Required. + :vartype upper_load_threshold: float + :ivar scale_interval: The period in seconds on which a decision is made whether to scale or + not. This property should come in ISO 8601 format "hh:mm:ss". Required. + :vartype scale_interval: str + :ivar kind: Specifies the trigger associated with this scaling policy. Required. Represents a + scaling trigger related to an average load of a metric/resource of a partition. The value is 0. + :vartype kind: str or + ~azure.mgmt.servicefabricmanagedclusters.models.AVERAGE_PARTITION_LOAD_TRIGGER """ - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } + metric_name: str = rest_field(name="metricName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the metric for which usage should be tracked. Required.""" + lower_load_threshold: float = rest_field( + name="lowerLoadThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The lower limit of the load below which a scale in operation should be performed. Required.""" + upper_load_threshold: float = rest_field( + name="upperLoadThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The upper limit of the load beyond which a scale out operation should be performed. Required.""" + scale_interval: str = rest_field(name="scaleInterval", visibility=["read", "create", "update", "delete", "query"]) + """The period in seconds on which a decision is made whether to scale or not. This property should + come in ISO 8601 format \"hh:mm:ss\". Required.""" + kind: Literal[ServiceScalingTriggerKind.AVERAGE_PARTITION_LOAD_TRIGGER] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the trigger associated with this scaling policy. Required. Represents a scaling + trigger related to an average load of a metric/resource of a partition. The value is 0.""" + + @overload + def __init__( + self, + *, + metric_name: str, + lower_load_threshold: float, + upper_load_threshold: float, + scale_interval: 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, kind=ServiceScalingTriggerKind.AVERAGE_PARTITION_LOAD_TRIGGER, **kwargs) + + +class AverageServiceLoadScalingTrigger(ScalingTrigger, discriminator="AverageServiceLoadTrigger"): + """Represents a scaling policy related to an average load of a metric/resource of a service. - def __init__(self, **kwargs): - super(AvailableOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get("provider", None) - self.resource = kwargs.get("resource", None) - self.operation = kwargs.get("operation", None) - self.description = kwargs.get("description", None) + :ivar metric_name: The name of the metric for which usage should be tracked. Required. + :vartype metric_name: str + :ivar lower_load_threshold: The lower limit of the load below which a scale in operation should + be performed. Required. + :vartype lower_load_threshold: float + :ivar upper_load_threshold: The upper limit of the load beyond which a scale out operation + should be performed. Required. + :vartype upper_load_threshold: float + :ivar scale_interval: The period in seconds on which a decision is made whether to scale or + not. This property should come in ISO 8601 format "hh:mm:ss". Required. + :vartype scale_interval: str + :ivar use_only_primary_load: Flag determines whether only the load of primary replica should be + considered for scaling. If set to true, then trigger will only consider the load of primary + replicas of stateful service. If set to false, trigger will consider load of all replicas. This + parameter cannot be set to true for stateless service. Required. + :vartype use_only_primary_load: bool + :ivar kind: Specifies the trigger associated with this scaling policy. Required. Represents a + scaling policy related to an average load of a metric/resource of a service. The value is 1. + :vartype kind: str or + ~azure.mgmt.servicefabricmanagedclusters.models.AVERAGE_SERVICE_LOAD_TRIGGER + """ + metric_name: str = rest_field(name="metricName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the metric for which usage should be tracked. Required.""" + lower_load_threshold: float = rest_field( + name="lowerLoadThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The lower limit of the load below which a scale in operation should be performed. Required.""" + upper_load_threshold: float = rest_field( + name="upperLoadThreshold", visibility=["read", "create", "update", "delete", "query"] + ) + """The upper limit of the load beyond which a scale out operation should be performed. Required.""" + scale_interval: str = rest_field(name="scaleInterval", visibility=["read", "create", "update", "delete", "query"]) + """The period in seconds on which a decision is made whether to scale or not. This property should + come in ISO 8601 format \"hh:mm:ss\". Required.""" + use_only_primary_load: bool = rest_field( + name="useOnlyPrimaryLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """Flag determines whether only the load of primary replica should be considered for scaling. If + set to true, then trigger will only consider the load of primary replicas of stateful service. + If set to false, trigger will consider load of all replicas. This parameter cannot be set to + true for stateless service. Required.""" + kind: Literal[ServiceScalingTriggerKind.AVERAGE_SERVICE_LOAD_TRIGGER] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the trigger associated with this scaling policy. Required. Represents a scaling + policy related to an average load of a metric/resource of a service. The value is 1.""" + + @overload + def __init__( + self, + *, + metric_name: str, + lower_load_threshold: float, + upper_load_threshold: float, + scale_interval: str, + use_only_primary_load: bool, + ) -> 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, kind=ServiceScalingTriggerKind.AVERAGE_SERVICE_LOAD_TRIGGER, **kwargs) + + +class AzureActiveDirectory(_Model): + """The settings to enable AAD authentication on the cluster. -class ScalingTrigger(msrest.serialization.Model): - """Describes the trigger for performing a scaling operation. + :ivar tenant_id: Azure active directory tenant id. + :vartype tenant_id: str + :ivar cluster_application: Azure active directory cluster application id. + :vartype cluster_application: str + :ivar client_application: Azure active directory client application id. + :vartype client_application: str + """ - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: AveragePartitionLoadScalingTrigger, AverageServiceLoadScalingTrigger. + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read", "create", "update", "delete", "query"]) + """Azure active directory tenant id.""" + cluster_application: Optional[str] = rest_field( + name="clusterApplication", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure active directory cluster application id.""" + client_application: Optional[str] = rest_field( + name="clientApplication", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure active directory client application id.""" + + @overload + def __init__( + self, + *, + tenant_id: Optional[str] = None, + cluster_application: Optional[str] = None, + client_application: 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 ClientCertificate(_Model): + """Client certificate definition. - All required parameters must be populated in order to send to Azure. + :ivar is_admin: Indicates if the client certificate has admin access to the cluster. Non admin + clients can perform only read only operations on the cluster. Required. + :vartype is_admin: bool + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar common_name: Certificate common name. + :vartype common_name: str + :ivar issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with + CommonName. + :vartype issuer_thumbprint: str + """ - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + is_admin: bool = rest_field(name="isAdmin", visibility=["read", "create", "update", "delete", "query"]) + """Indicates if the client certificate has admin access to the cluster. Non admin clients can + perform only read only operations on the cluster. Required.""" + thumbprint: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Certificate thumbprint.""" + common_name: Optional[str] = rest_field( + name="commonName", visibility=["read", "create", "update", "delete", "query"] + ) + """Certificate common name.""" + issuer_thumbprint: Optional[str] = rest_field( + name="issuerThumbprint", visibility=["read", "create", "update", "delete", "query"] + ) + """Issuer thumbprint for the certificate. Only used together with CommonName.""" + + @overload + def __init__( + self, + *, + is_admin: bool, + thumbprint: Optional[str] = None, + common_name: Optional[str] = None, + issuer_thumbprint: 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 ClusterHealthPolicy(_Model): + """Defines a health policy used to evaluate the health of the cluster or of a cluster node. + + :ivar max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number of + nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage + is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage should + be configured to tolerate that. Required. + :vartype max_percent_unhealthy_nodes: int + :ivar max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + applications before reporting an error. For example, to allow 10% of applications to be + unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. Required. + :vartype max_percent_unhealthy_applications: int """ - _validation = { - "kind": {"required": True}, - } + max_percent_unhealthy_nodes: int = rest_field( + name="maxPercentUnhealthyNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy nodes before reporting an error. For example, to + allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number of + nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage + is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage should + be configured to tolerate that. Required.""" + max_percent_unhealthy_applications: int = rest_field( + name="maxPercentUnhealthyApplications", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy applications before reporting an error. For + example, to allow 10% of applications to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. Required.""" + + @overload + def __init__( + self, + *, + max_percent_unhealthy_nodes: int, + max_percent_unhealthy_applications: int, + ) -> 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 ClusterMonitoringPolicy(_Model): + """Describes the monitoring policies for the cluster upgrade. + + :ivar health_check_wait_duration: The length of time to wait after completing an upgrade domain + before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. Required. + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in + either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either + hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before the + upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before the + upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. + :vartype upgrade_domain_timeout: str + """ - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - } + health_check_wait_duration: str = rest_field( + name="healthCheckWaitDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The length of time to wait after completing an upgrade domain before performing health checks. + The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required.""" + health_check_stable_duration: str = rest_field( + name="healthCheckStableDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time that the application or cluster must remain healthy before the upgrade + proceeds to the next upgrade domain. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. Required.""" + health_check_retry_timeout: str = rest_field( + name="healthCheckRetryTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time to retry health evaluation when the application or cluster is unhealthy + before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. Required.""" + upgrade_timeout: str = rest_field(name="upgradeTimeout", visibility=["read", "create", "update", "delete", "query"]) + """The amount of time the overall upgrade has to complete before the upgrade rolls back. The + timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required.""" + upgrade_domain_timeout: str = rest_field( + name="upgradeDomainTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time each upgrade domain has to complete before the upgrade rolls back. The + timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required.""" + + @overload + def __init__( + self, + *, + health_check_wait_duration: str, + health_check_stable_duration: str, + health_check_retry_timeout: str, + upgrade_timeout: str, + upgrade_domain_timeout: 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 ClusterUpgradeDeltaHealthPolicy(_Model): + """Describes the delta health policies for the cluster upgrade. + + :ivar max_percent_delta_unhealthy_nodes: The maximum allowed percentage of nodes health + degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. Required. + :vartype max_percent_delta_unhealthy_nodes: int + :ivar max_percent_upgrade_domain_delta_unhealthy_nodes: The maximum allowed percentage of + upgrade domain nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade + and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits. + :vartype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :ivar max_percent_delta_unhealthy_applications: The maximum allowed percentage of applications + health degradation allowed during cluster upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and the + state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + NOTE: This value will overwrite the value specified in + properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications. + :vartype max_percent_delta_unhealthy_applications: int + """ - _subtype_map = { - "kind": { - "AveragePartitionLoadTrigger": "AveragePartitionLoadScalingTrigger", - "AverageServiceLoadTrigger": "AverageServiceLoadScalingTrigger", - } - } + max_percent_delta_unhealthy_nodes: int = rest_field( + name="maxPercentDeltaUnhealthyNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. Required.""" + max_percent_upgrade_domain_delta_unhealthy_nodes: Optional[int] = rest_field( + name="maxPercentUpgradeDomainDeltaUnhealthyNodes", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of upgrade domain nodes health degradation allowed during + cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade + and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits.""" + max_percent_delta_unhealthy_applications: Optional[int] = rest_field( + name="maxPercentDeltaUnhealthyApplications", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of applications health degradation allowed during cluster + upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and the + state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + NOTE: This value will overwrite the value specified in + properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications.""" + + @overload + def __init__( + self, + *, + max_percent_delta_unhealthy_nodes: int, + max_percent_upgrade_domain_delta_unhealthy_nodes: Optional[int] = None, + max_percent_delta_unhealthy_applications: 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 ClusterUpgradePolicy(_Model): + """Describes the policy used when upgrading the cluster. + + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when + the code version has not changed (the upgrade only changes configuration or data). + :vartype force_restart: bool + :ivar health_policy: The cluster health policy defines a health policy used to evaluate the + health of the cluster during a cluster upgrade. + :vartype health_policy: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy + :ivar delta_health_policy: The cluster delta health policy defines a health policy used to + evaluate the health of the cluster during a cluster upgrade. + :vartype delta_health_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy + :ivar monitoring_policy: The cluster monitoring policy describes the parameters for monitoring + an upgrade in Monitored mode. + :vartype monitoring_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy + :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an + upgrade domain and prevent loss of availability when there are unexpected issues. + When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. + The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss + or in d.hh:mm:ss.ms format. + This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds). + :vartype upgrade_replica_set_check_timeout: str + """ - def __init__(self, **kwargs): - super(ScalingTrigger, self).__init__(**kwargs) - self.kind = None # type: Optional[str] + force_restart: Optional[bool] = rest_field( + name="forceRestart", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, then processes are forcefully restarted during upgrade even when the code version has + not changed (the upgrade only changes configuration or data).""" + health_policy: Optional["_models.ClusterHealthPolicy"] = rest_field( + name="healthPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster health policy defines a health policy used to evaluate the health of the cluster + during a cluster upgrade.""" + delta_health_policy: Optional["_models.ClusterUpgradeDeltaHealthPolicy"] = rest_field( + name="deltaHealthPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster delta health policy defines a health policy used to evaluate the health of the + cluster during a cluster upgrade.""" + monitoring_policy: Optional["_models.ClusterMonitoringPolicy"] = rest_field( + name="monitoringPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The cluster monitoring policy describes the parameters for monitoring an upgrade in Monitored + mode.""" + upgrade_replica_set_check_timeout: Optional[str] = rest_field( + name="upgradeReplicaSetCheckTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum amount of time to block processing of an upgrade domain and prevent loss of + availability when there are unexpected issues. + When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. + The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss + or in d.hh:mm:ss.ms format. + This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds).""" + + @overload + def __init__( + self, + *, + force_restart: Optional[bool] = None, + health_policy: Optional["_models.ClusterHealthPolicy"] = None, + delta_health_policy: Optional["_models.ClusterUpgradeDeltaHealthPolicy"] = None, + monitoring_policy: Optional["_models.ClusterMonitoringPolicy"] = None, + upgrade_replica_set_check_timeout: 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 EndpointRangeDescription(_Model): + """Port range details. + :ivar start_port: Starting port of a range of ports. Required. + :vartype start_port: int + :ivar end_port: End port of a range of ports. Required. + :vartype end_port: int + """ -class AveragePartitionLoadScalingTrigger(ScalingTrigger): - """Represents a scaling trigger related to an average load of a metric/resource of a partition. + start_port: int = rest_field(name="startPort", visibility=["read", "create", "update", "delete", "query"]) + """Starting port of a range of ports. Required.""" + end_port: int = rest_field(name="endPort", visibility=["read", "create", "update", "delete", "query"]) + """End port of a range of ports. Required.""" - All required parameters must be populated in order to send to Azure. - - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind - :param metric_name: Required. The name of the metric for which usage should be tracked. - :type metric_name: str - :param lower_load_threshold: Required. The lower limit of the load below which a scale in - operation should be performed. - :type lower_load_threshold: float - :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out - operation should be performed. - :type upper_load_threshold: float - :param scale_interval: Required. The period in seconds on which a decision is made whether to - scale or not. This property should come in ISO 8601 format "hh:mm:ss". - :type scale_interval: str - """ - - _validation = { - "kind": {"required": True}, - "metric_name": {"required": True}, - "lower_load_threshold": {"required": True}, - "upper_load_threshold": {"required": True}, - "scale_interval": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "lower_load_threshold": {"key": "lowerLoadThreshold", "type": "float"}, - "upper_load_threshold": {"key": "upperLoadThreshold", "type": "float"}, - "scale_interval": {"key": "scaleInterval", "type": "str"}, - } - - def __init__(self, **kwargs): - super(AveragePartitionLoadScalingTrigger, self).__init__(**kwargs) - self.kind = "AveragePartitionLoadTrigger" # type: str - self.metric_name = kwargs["metric_name"] - self.lower_load_threshold = kwargs["lower_load_threshold"] - self.upper_load_threshold = kwargs["upper_load_threshold"] - self.scale_interval = kwargs["scale_interval"] - - -class AverageServiceLoadScalingTrigger(ScalingTrigger): - """Represents a scaling policy related to an average load of a metric/resource of a service. + @overload + def __init__( + self, + *, + start_port: int, + end_port: int, + ) -> None: ... - All required parameters must be populated in order to send to Azure. - - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind - :param metric_name: Required. The name of the metric for which usage should be tracked. - :type metric_name: str - :param lower_load_threshold: Required. The lower limit of the load below which a scale in - operation should be performed. - :type lower_load_threshold: float - :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out - operation should be performed. - :type upper_load_threshold: float - :param scale_interval: Required. The period in seconds on which a decision is made whether to - scale or not. This property should come in ISO 8601 format "hh:mm:ss". - :type scale_interval: str - :param use_only_primary_load: Required. Flag determines whether only the load of primary - replica should be considered for scaling. If set to true, then trigger will only consider the - load of primary replicas of stateful service. If set to false, trigger will consider load of - all replicas. This parameter cannot be set to true for stateless service. - :type use_only_primary_load: bool - """ - - _validation = { - "kind": {"required": True}, - "metric_name": {"required": True}, - "lower_load_threshold": {"required": True}, - "upper_load_threshold": {"required": True}, - "scale_interval": {"required": True}, - "use_only_primary_load": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "lower_load_threshold": {"key": "lowerLoadThreshold", "type": "float"}, - "upper_load_threshold": {"key": "upperLoadThreshold", "type": "float"}, - "scale_interval": {"key": "scaleInterval", "type": "str"}, - "use_only_primary_load": {"key": "useOnlyPrimaryLoad", "type": "bool"}, - } - - def __init__(self, **kwargs): - super(AverageServiceLoadScalingTrigger, self).__init__(**kwargs) - self.kind = "AverageServiceLoadTrigger" # type: str - self.metric_name = kwargs["metric_name"] - self.lower_load_threshold = kwargs["lower_load_threshold"] - self.upper_load_threshold = kwargs["upper_load_threshold"] - self.scale_interval = kwargs["scale_interval"] - self.use_only_primary_load = kwargs["use_only_primary_load"] - - -class AzureActiveDirectory(msrest.serialization.Model): - """The settings to enable AAD authentication on the cluster. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - :param tenant_id: Azure active directory tenant id. - :type tenant_id: str - :param cluster_application: Azure active directory cluster application id. - :type cluster_application: str - :param client_application: Azure active directory client application id. - :type client_application: str - """ + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "cluster_application": {"key": "clusterApplication", "type": "str"}, - "client_application": {"key": "clientApplication", "type": "str"}, - } - def __init__(self, **kwargs): - super(AzureActiveDirectory, self).__init__(**kwargs) - self.tenant_id = kwargs.get("tenant_id", None) - self.cluster_application = kwargs.get("cluster_application", None) - self.client_application = kwargs.get("client_application", None) +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 + """ -class ClientCertificate(msrest.serialization.Model): - """Client certificate definition. + 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.servicefabricmanagedclusters.models.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: + list[~azure.mgmt.servicefabricmanagedclusters.models.ErrorAdditionalInfo] + """ - All required parameters must be populated in order to send to Azure. + 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 ErrorModelError(_Model): + """The error details. - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. - Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param thumbprint: Certificate thumbprint. - :type thumbprint: str - :param common_name: Certificate common name. - :type common_name: str - :param issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with - CommonName. - :type issuer_thumbprint: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str """ - _validation = { - "is_admin": {"required": True}, - } + code: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error message.""" - _attribute_map = { - "is_admin": {"key": "isAdmin", "type": "bool"}, - "thumbprint": {"key": "thumbprint", "type": "str"}, - "common_name": {"key": "commonName", "type": "str"}, - "issuer_thumbprint": {"key": "issuerThumbprint", "type": "str"}, - } + @overload + def __init__( + self, + *, + code: Optional[str] = None, + message: Optional[str] = None, + ) -> None: ... - def __init__(self, **kwargs): - super(ClientCertificate, self).__init__(**kwargs) - self.is_admin = kwargs["is_admin"] - self.thumbprint = kwargs.get("thumbprint", None) - self.common_name = kwargs.get("common_name", None) - self.issuer_thumbprint = kwargs.get("issuer_thumbprint", 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 EndpointRangeDescription(msrest.serialization.Model): - """Port range details. - All required parameters must be populated in order to send to Azure. +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.servicefabricmanagedclusters.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 FaultSimulation(_Model): + """Fault simulation object with status. + + :ivar simulation_id: unique identifier for the fault simulation. + :vartype simulation_id: str + :ivar status: Fault simulation status. Known values are: "Starting", "Active", "Stopping", + "Done", "StartFailed", and "StopFailed". + :vartype status: str or ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationStatus + :ivar start_time: The start time of the fault simulation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the fault simulation. + :vartype end_time: ~datetime.datetime + :ivar details: Fault simulation details. + :vartype details: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationDetails + """ - :param start_port: Required. Starting port of a range of ports. - :type start_port: int - :param end_port: Required. End port of a range of ports. - :type end_port: int + simulation_id: Optional[str] = rest_field( + name="simulationId", visibility=["read", "create", "update", "delete", "query"] + ) + """unique identifier for the fault simulation.""" + status: Optional[Union[str, "_models.FaultSimulationStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fault simulation status. Known values are: \"Starting\", \"Active\", \"Stopping\", \"Done\", + \"StartFailed\", and \"StopFailed\".""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the fault simulation.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time of the fault simulation.""" + details: Optional["_models.FaultSimulationDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fault simulation details.""" + + @overload + def __init__( + self, + *, + simulation_id: Optional[str] = None, + status: Optional[Union[str, "_models.FaultSimulationStatus"]] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + details: Optional["_models.FaultSimulationDetails"] = 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 FaultSimulationConstraints(_Model): + """Constraints for Fault Simulation action. + + :ivar expiration_time: The absolute expiration timestamp (UTC) after which this fault + simulation should be stopped if it's still active. + :vartype expiration_time: ~datetime.datetime """ - _validation = { - "start_port": {"required": True}, - "end_port": {"required": True}, - } + expiration_time: Optional[datetime.datetime] = rest_field( + name="expirationTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The absolute expiration timestamp (UTC) after which this fault simulation should be stopped if + it's still active.""" + + @overload + def __init__( + self, + *, + expiration_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 FaultSimulationContent(_Model): + """Parameters for Fault Simulation action. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ZoneFaultSimulationContent + + :ivar fault_kind: The kind of fault to be simulated. Required. "Zone" + :vartype fault_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.FaultKind + :ivar force: Force the action to go through without any check on the cluster. + :vartype force: bool + :ivar constraints: Constraints for Fault Simulation action. + :vartype constraints: + ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationConstraints + """ + + __mapping__: Dict[str, _Model] = {} + fault_kind: str = rest_discriminator(name="faultKind", visibility=["read", "create", "update", "delete", "query"]) + """The kind of fault to be simulated. Required. \"Zone\"""" + force: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Force the action to go through without any check on the cluster.""" + constraints: Optional["_models.FaultSimulationConstraints"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Constraints for Fault Simulation action.""" + + @overload + def __init__( + self, + *, + fault_kind: str, + force: Optional[bool] = None, + constraints: Optional["_models.FaultSimulationConstraints"] = 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 FaultSimulationContentWrapper(_Model): + """Fault Simulation Request for Start action. + + :ivar parameters: Parameters for Fault Simulation start action. Required. + :vartype parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContent + """ - _attribute_map = { - "start_port": {"key": "startPort", "type": "int"}, - "end_port": {"key": "endPort", "type": "int"}, - } + parameters: "_models.FaultSimulationContent" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Parameters for Fault Simulation start action. Required.""" - def __init__(self, **kwargs): - super(EndpointRangeDescription, self).__init__(**kwargs) - self.start_port = kwargs["start_port"] - self.end_port = kwargs["end_port"] + @overload + def __init__( + self, + *, + parameters: "_models.FaultSimulationContent", + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class ErrorModel(msrest.serialization.Model): - """The structure of the error. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - :param error: The error details. - :type error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + +class FaultSimulationDetails(_Model): + """Details for Fault Simulation. + + :ivar cluster_id: unique identifier for the cluster resource. + :vartype cluster_id: str + :ivar operation_id: unique identifier for the operation associated with the fault simulation. + :vartype operation_id: str + :ivar node_type_fault_simulation: List of node type simulations associated with the cluster + fault simulation. + :vartype node_type_fault_simulation: + list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeFaultSimulation] + :ivar parameters: Fault simulation parameters. + :vartype parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContent """ - _attribute_map = { - "error": {"key": "error", "type": "ErrorModelError"}, - } + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read", "create", "update", "delete", "query"]) + """unique identifier for the cluster resource.""" + operation_id: Optional[str] = rest_field( + name="operationId", visibility=["read", "create", "update", "delete", "query"] + ) + """unique identifier for the operation associated with the fault simulation.""" + node_type_fault_simulation: Optional[List["_models.NodeTypeFaultSimulation"]] = rest_field( + name="nodeTypeFaultSimulation", visibility=["read", "create", "update", "delete", "query"] + ) + """List of node type simulations associated with the cluster fault simulation.""" + parameters: Optional["_models.FaultSimulationContent"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fault simulation parameters.""" + + @overload + def __init__( + self, + *, + cluster_id: Optional[str] = None, + operation_id: Optional[str] = None, + node_type_fault_simulation: Optional[List["_models.NodeTypeFaultSimulation"]] = None, + parameters: Optional["_models.FaultSimulationContent"] = 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 FaultSimulationIdContent(_Model): + """Parameters for Fault Simulation id. + + :ivar simulation_id: unique identifier for the fault simulation. Required. + :vartype simulation_id: str + """ - def __init__(self, **kwargs): - super(ErrorModel, self).__init__(**kwargs) - self.error = kwargs.get("error", None) + simulation_id: str = rest_field(name="simulationId", visibility=["read", "create", "update", "delete", "query"]) + """unique identifier for the fault simulation. Required.""" + + @overload + def __init__( + self, + *, + simulation_id: 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 FrontendConfiguration(_Model): + """Describes the frontend configurations for the node type. + + :ivar ip_address_type: The IP address type of this frontend configuration. If omitted the + default value is IPv4. Known values are: "IPv4" and "IPv6". + :vartype ip_address_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.IPAddressType + :ivar load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend + address pool that the VM instances of the node type are associated with. The format of the + resource Id is + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'. + :vartype load_balancer_backend_address_pool_id: str + :ivar load_balancer_inbound_nat_pool_id: The resource Id of the Load Balancer inbound NAT pool + that the VM instances of the node type are associated with. The format of the resource Id is + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}'. + :vartype load_balancer_inbound_nat_pool_id: str + :ivar application_gateway_backend_address_pool_id: The resource Id of application gateway + backend address pool. The format of the resource Id is + '/subscriptions//resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}'. + :vartype application_gateway_backend_address_pool_id: str + """ + ip_address_type: Optional[Union[str, "_models.IPAddressType"]] = rest_field( + name="ipAddressType", visibility=["read", "create", "update", "delete", "query"] + ) + """The IP address type of this frontend configuration. If omitted the default value is IPv4. Known + values are: \"IPv4\" and \"IPv6\".""" + load_balancer_backend_address_pool_id: Optional[str] = rest_field( + name="loadBalancerBackendAddressPoolId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of the Load Balancer backend address pool that the VM instances of the node + type are associated with. The format of the resource Id is + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendAddressPoolName}'.""" + load_balancer_inbound_nat_pool_id: Optional[str] = rest_field( + name="loadBalancerInboundNatPoolId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of the Load Balancer inbound NAT pool that the VM instances of the node type + are associated with. The format of the resource Id is + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/inboundNatPools/{inboundNatPoolName}'.""" + application_gateway_backend_address_pool_id: Optional[str] = rest_field( + name="applicationGatewayBackendAddressPoolId", visibility=["read", "create", "update", "delete", "query"] + ) + """The resource Id of application gateway backend address pool. The format of the resource Id is + '/subscriptions//resourceGroups/{resourceGroupName}/providers/Microsoft.Network/applicationGateways/{applicationGatewayName}/backendAddressPools/{backendAddressPoolName}'.""" + + @overload + def __init__( + self, + *, + ip_address_type: Optional[Union[str, "_models.IPAddressType"]] = None, + load_balancer_backend_address_pool_id: Optional[str] = None, + load_balancer_inbound_nat_pool_id: Optional[str] = None, + application_gateway_backend_address_pool_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 IpConfiguration(_Model): + """Specifies an IP configuration of the network interface. + + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar application_gateway_backend_address_pools: Specifies an array of references to backend + address pools of application gateways. A node type can reference backend address pools of + multiple application gateways. Multiple node types cannot use the same application gateway. + :vartype application_gateway_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address + pools of load balancers. A node type can reference backend address pools of one public and one + internal load balancer. Multiple node types cannot use the same basic sku load balancer. + :vartype load_balancer_backend_address_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools of + the load balancers. A node type can reference inbound nat pools of one public and one internal + load balancer. Multiple node types cannot use the same basic sku load balancer. + :vartype load_balancer_inbound_nat_pools: + list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] + :ivar subnet: Specifies the subnet of the network interface. + :vartype subnet: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :ivar private_ip_address_version: Specifies whether the IP configuration's private IP is IPv4 + or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype private_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion + :ivar public_ip_address_configuration: The public IP address configuration of the network + interface. + :vartype public_ip_address_configuration: + ~azure.mgmt.servicefabricmanagedclusters.models.IPConfigurationPublicIPAddressConfiguration + """ -class ErrorModelError(msrest.serialization.Model): - """The error details. + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the network interface. Required.""" + application_gateway_backend_address_pools: Optional[List["_models.SubResource"]] = rest_field( + name="applicationGatewayBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to backend address pools of application gateways. A node type + can reference backend address pools of multiple application gateways. Multiple node types + cannot use the same application gateway.""" + load_balancer_backend_address_pools: Optional[List["_models.SubResource"]] = rest_field( + name="loadBalancerBackendAddressPools", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to backend address pools of load balancers. A node type can + reference backend address pools of one public and one internal load balancer. Multiple node + types cannot use the same basic sku load balancer.""" + load_balancer_inbound_nat_pools: Optional[List["_models.SubResource"]] = rest_field( + name="loadBalancerInboundNatPools", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies an array of references to inbound Nat pools of the load balancers. A node type can + reference inbound nat pools of one public and one internal load balancer. Multiple node types + cannot use the same basic sku load balancer.""" + subnet: Optional["_models.SubResource"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the subnet of the network interface.""" + private_ip_address_version: Optional[Union[str, "_models.PrivateIPAddressVersion"]] = rest_field( + name="privateIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the IP configuration's private IP is IPv4 or IPv6. Default is IPv4. Known + values are: \"IPv4\" and \"IPv6\".""" + public_ip_address_configuration: Optional["_models.IPConfigurationPublicIPAddressConfiguration"] = rest_field( + name="publicIPAddressConfiguration", visibility=["read", "create", "update", "delete", "query"] + ) + """The public IP address configuration of the network interface.""" + + @overload + def __init__( + self, + *, + name: str, + application_gateway_backend_address_pools: Optional[List["_models.SubResource"]] = None, + load_balancer_backend_address_pools: Optional[List["_models.SubResource"]] = None, + load_balancer_inbound_nat_pools: Optional[List["_models.SubResource"]] = None, + subnet: Optional["_models.SubResource"] = None, + private_ip_address_version: Optional[Union[str, "_models.PrivateIPAddressVersion"]] = None, + public_ip_address_configuration: Optional["_models.IPConfigurationPublicIPAddressConfiguration"] = 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 IPConfigurationPublicIPAddressConfiguration(_Model): # pylint: disable=name-too-long + """The public IP address configuration of the network interface. + + :ivar name: Name of the network interface. Required. + :vartype name: str + :ivar ip_tags: Specifies the list of IP tags associated with the public IP address. + :vartype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] + :ivar public_ip_address_version: Specifies whether the IP configuration's public IP is IPv4 or + IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". + :vartype public_ip_address_version: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion + """ - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the network interface. Required.""" + ip_tags: Optional[List["_models.IpTag"]] = rest_field( + name="ipTags", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the list of IP tags associated with the public IP address.""" + public_ip_address_version: Optional[Union[str, "_models.PublicIPAddressVersion"]] = rest_field( + name="publicIPAddressVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the IP configuration's public IP is IPv4 or IPv6. Default is IPv4. Known + values are: \"IPv4\" and \"IPv6\".""" + + @overload + def __init__( + self, + *, + name: str, + ip_tags: Optional[List["_models.IpTag"]] = None, + public_ip_address_version: Optional[Union[str, "_models.PublicIPAddressVersion"]] = 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 IpTag(_Model): + """The IP tag associated with the public IP address. + + :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. Required. + :vartype ip_tag_type: str + :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. Required. + :vartype tag: str """ - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } + ip_tag_type: str = rest_field(name="ipTagType", visibility=["read", "create", "update", "delete", "query"]) + """IP tag type. Example: FirstPartyUsage. Required.""" + tag: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """IP tag associated with the public IP. Example: SQL, Storage etc. Required.""" + + @overload + def __init__( + self, + *, + ip_tag_type: str, + tag: str, + ) -> None: ... - def __init__(self, **kwargs): - super(ErrorModelError, self).__init__(**kwargs) - self.code = kwargs.get("code", None) - self.message = kwargs.get("message", 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 LoadBalancingRule(msrest.serialization.Model): + +class LoadBalancingRule(_Model): """Describes a load balancing rule. - All required parameters must be populated in order to send to Azure. - - :param frontend_port: Required. The port for the external endpoint. Port numbers for each rule - must be unique within the Load Balancer. Acceptable values are between 1 and 65534. - :type frontend_port: int - :param backend_port: Required. The port used for internal connections on the endpoint. - Acceptable values are between 1 and 65535. - :type backend_port: int - :param protocol: Required. The reference to the transport protocol used by the load balancing - rule. Possible values include: "tcp", "udp". - :type protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol - :param probe_port: The prob port used by the load balancing rule. Acceptable values are between + :ivar frontend_port: The port for the external endpoint. Port numbers for each rule must be + unique within the Load Balancer. Acceptable values are between 1 and 65534. Required. + :vartype frontend_port: int + :ivar backend_port: The port used for internal connections on the endpoint. Acceptable values + are between 1 and 65535. Required. + :vartype backend_port: int + :ivar protocol: The reference to the transport protocol used by the load balancing rule. + Required. Known values are: "tcp" and "udp". + :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.Protocol + :ivar probe_port: The prob port used by the load balancing rule. Acceptable values are between 1 and 65535. - :type probe_port: int - :param probe_protocol: Required. the reference to the load balancer probe used by the load - balancing rule. Possible values include: "tcp", "http", "https". - :type probe_protocol: str or - ~service_fabric_managed_clusters_management_client.models.ProbeProtocol - :param probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. - :type probe_request_path: str - """ - - _validation = { - "frontend_port": {"required": True, "maximum": 65534, "minimum": 1}, - "backend_port": {"required": True, "maximum": 65534, "minimum": 1}, - "protocol": {"required": True}, - "probe_port": {"maximum": 65534, "minimum": 1}, - "probe_protocol": {"required": True}, - } - - _attribute_map = { - "frontend_port": {"key": "frontendPort", "type": "int"}, - "backend_port": {"key": "backendPort", "type": "int"}, - "protocol": {"key": "protocol", "type": "str"}, - "probe_port": {"key": "probePort", "type": "int"}, - "probe_protocol": {"key": "probeProtocol", "type": "str"}, - "probe_request_path": {"key": "probeRequestPath", "type": "str"}, - } - - def __init__(self, **kwargs): - super(LoadBalancingRule, self).__init__(**kwargs) - self.frontend_port = kwargs["frontend_port"] - self.backend_port = kwargs["backend_port"] - self.protocol = kwargs["protocol"] - self.probe_port = kwargs.get("probe_port", None) - self.probe_protocol = kwargs["probe_protocol"] - self.probe_request_path = kwargs.get("probe_request_path", None) - - -class Resource(msrest.serialization.Model): - """The resource model 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 Azure. + :vartype probe_port: int + :ivar probe_protocol: the reference to the load balancer probe used by the load balancing rule. + Required. Known values are: "tcp", "http", and "https". + :vartype probe_protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol + :ivar probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. + :vartype probe_request_path: str + :ivar load_distribution: The load distribution policy for this rule. + :vartype load_distribution: str + """ - :ivar id: Azure resource identifier. + frontend_port: int = rest_field(name="frontendPort", visibility=["read", "create", "update", "delete", "query"]) + """The port for the external endpoint. Port numbers for each rule must be unique within the Load + Balancer. Acceptable values are between 1 and 65534. Required.""" + backend_port: int = rest_field(name="backendPort", visibility=["read", "create", "update", "delete", "query"]) + """The port used for internal connections on the endpoint. Acceptable values are between 1 and + 65535. Required.""" + protocol: Union[str, "_models.Protocol"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reference to the transport protocol used by the load balancing rule. Required. Known values + are: \"tcp\" and \"udp\".""" + probe_port: Optional[int] = rest_field(name="probePort", visibility=["read", "create", "update", "delete", "query"]) + """The prob port used by the load balancing rule. Acceptable values are between 1 and 65535.""" + probe_protocol: Union[str, "_models.ProbeProtocol"] = rest_field( + name="probeProtocol", visibility=["read", "create", "update", "delete", "query"] + ) + """the reference to the load balancer probe used by the load balancing rule. Required. Known + values are: \"tcp\", \"http\", and \"https\".""" + probe_request_path: Optional[str] = rest_field( + name="probeRequestPath", visibility=["read", "create", "update", "delete", "query"] + ) + """The probe request path. Only supported for HTTP/HTTPS probes.""" + load_distribution: Optional[str] = rest_field( + name="loadDistribution", visibility=["read", "create", "update", "delete", "query"] + ) + """The load distribution policy for this rule.""" + + @overload + def __init__( + self, + *, + frontend_port: int, + backend_port: int, + protocol: Union[str, "_models.Protocol"], + probe_protocol: Union[str, "_models.ProbeProtocol"], + probe_port: Optional[int] = None, + probe_request_path: Optional[str] = None, + load_distribution: 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 LongRunningOperationResult(_Model): + """Long running operation result. + + :ivar name: The name of the operation. + :vartype name: str + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: The completion percentage of the operation. + :vartype percent_complete: float + :ivar status: The status of the operation. + :vartype status: str + :ivar error: The operation error. + :vartype error: ~azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError + """ + + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the operation.""" + start_time: Optional[datetime.datetime] = rest_field( + name="startTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The start time of the operation.""" + end_time: Optional[datetime.datetime] = rest_field( + name="endTime", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The end time of the operation.""" + percent_complete: Optional[float] = rest_field( + name="percentComplete", visibility=["read", "create", "update", "delete", "query"] + ) + """The completion percentage of the operation.""" + status: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The status of the operation.""" + error: Optional["_models.ErrorModelError"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The operation error.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + status: Optional[str] = None, + error: Optional["_models.ErrorModelError"] = 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 ManagedAzResiliencyStatus(_Model): + """Describes the result of the request to list Managed VM Sizes for Service Fabric Managed + Clusters. + + :ivar base_resource_status: List of Managed VM Sizes for Service Fabric Managed Clusters. + :vartype base_resource_status: + list[~azure.mgmt.servicefabricmanagedclusters.models.ResourceAzStatus] + :ivar is_cluster_zone_resilient: URL to get the next set of Managed VM Sizes if there are any. + :vartype is_cluster_zone_resilient: bool + """ + + base_resource_status: Optional[List["_models.ResourceAzStatus"]] = rest_field( + name="baseResourceStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """List of Managed VM Sizes for Service Fabric Managed Clusters.""" + is_cluster_zone_resilient: Optional[bool] = rest_field(name="isClusterZoneResilient", visibility=["read"]) + """URL to get the next set of Managed VM Sizes if there are any.""" + + @overload + def __init__( + self, + *, + base_resource_status: Optional[List["_models.ResourceAzStatus"]] = 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 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: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": 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}"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs["location"] - self.tags = kwargs.get("tags", None) - self.etag = None - self.system_data = None - - -class ManagedCluster(Resource): - """The manged cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.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 id: Azure resource identifier. + 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 ManagedCluster(TrackedResource): + """The managed cluster resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The managed cluster resource properties. + :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterProperties + :ivar etag: If eTag is provided in the response body, it may also be provided as a header per + the normal etag convention. Entity tags are used for comparing two or more entities from the + same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match + (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.",. :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param sku: The sku of the managed cluster. - :type sku: ~service_fabric_managed_clusters_management_client.models.Sku - :param dns_name: The cluster dns name. - :type dns_name: str + :ivar sku: The sku of the managed cluster. Required. + :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.Sku + """ + + properties: Optional["_models.ManagedClusterProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The managed cluster resource properties.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """If eTag is provided in the response body, it may also be provided as a header per the normal + etag convention. Entity tags are used for comparing two or more entities from the same + requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section + 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields.\",.""" + sku: "_models.Sku" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The sku of the managed cluster. Required.""" + + __flattened_items = [ + "dns_name", + "fqdn", + "ipv4_address", + "cluster_id", + "cluster_state", + "cluster_certificate_thumbprints", + "client_connection_port", + "http_gateway_connection_port", + "admin_user_name", + "admin_password", + "load_balancing_rules", + "allow_rdp_access", + "network_security_rules", + "clients", + "azure_active_directory", + "fabric_settings", + "provisioning_state", + "cluster_code_version", + "cluster_upgrade_mode", + "cluster_upgrade_cadence", + "addon_features", + "enable_auto_os_upgrade", + "zonal_resiliency", + "application_type_versions_cleanup_policy", + "enable_ipv6", + "subnet_id", + "ip_tags", + "ipv6_address", + "enable_service_public_ip", + "auxiliary_subnets", + "service_endpoints", + "zonal_update_mode", + "use_custom_vnet", + "public_ip_prefix_id", + "public_i_pv6_prefix_id", + "ddos_protection_plan_id", + "upgrade_description", + "http_gateway_token_auth_connection_port", + "enable_http_gateway_exclusive_auth_mode", + "auto_generated_domain_name_label_scope", + "allocated_outbound_ports", + "vm_image", + ] + + @overload + def __init__( + self, + *, + location: str, + sku: "_models.Sku", + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.ManagedClusterProperties"] = 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 ManagedClusterCodeVersionResult(_Model): + """The result of the Service Fabric runtime versions. + + :ivar id: The identification of the result. + :vartype id: str + :ivar name: The name of the result. + :vartype name: str + :ivar type: The result resource type. + :vartype type: str + :ivar properties: The detail of the Service Fabric runtime version result. + :vartype properties: + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionDetails + """ + + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The identification of the result.""" + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the result.""" + type: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The result resource type.""" + properties: Optional["_models.ManagedClusterVersionDetails"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The detail of the Service Fabric runtime version result.""" + + __flattened_items = ["cluster_code_version", "support_expiry_utc", "os_type"] + + @overload + def __init__( + self, + *, + id: Optional[str] = None, # pylint: disable=redefined-builtin + name: Optional[str] = None, + type: Optional[str] = None, + properties: Optional["_models.ManagedClusterVersionDetails"] = 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 ManagedClusterProperties(_Model): + """Describes the managed cluster resource properties. + + :ivar dns_name: The cluster dns name. Required. + :vartype dns_name: str :ivar fqdn: The fully qualified domain name associated with the public load balancer of the cluster. :vartype fqdn: str @@ -1010,1336 +2497,2617 @@ class ManagedCluster(Resource): :vartype ipv4_address: str :ivar cluster_id: A service generated unique identifier for the cluster resource. :vartype cluster_id: str - :ivar cluster_state: The current state of the cluster. Possible values include: - "WaitingForNodes", "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", "Ready". - :vartype cluster_state: str or - ~service_fabric_managed_clusters_management_client.models.ClusterState + :ivar cluster_state: The current state of the cluster. Known values are: "WaitingForNodes", + "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", and "Ready". + :vartype cluster_state: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterState :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. :vartype cluster_certificate_thumbprints: list[str] - :param client_connection_port: The port used for client connections to the cluster. - :type client_connection_port: int - :param http_gateway_connection_port: The port used for HTTP connections to the cluster. - :type http_gateway_connection_port: int - :param admin_user_name: VM admin user name. - :type admin_user_name: str - :param admin_password: VM admin user password. - :type admin_password: str - :param load_balancing_rules: Load balancing rules that are applied to the public load balancer + :ivar client_connection_port: The port used for client connections to the cluster. + :vartype client_connection_port: int + :ivar http_gateway_connection_port: The port used for HTTP connections to the cluster. + :vartype http_gateway_connection_port: int + :ivar admin_user_name: VM admin user name. Required. + :vartype admin_user_name: str + :ivar admin_password: VM admin user password. + :vartype admin_password: str + :ivar load_balancing_rules: Load balancing rules that are applied to the public load balancer of the cluster. - :type load_balancing_rules: - list[~service_fabric_managed_clusters_management_client.models.LoadBalancingRule] - :param allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG - rule opens RDP port to internet which can be overridden with custom Network Security Rules. The + :vartype load_balancing_rules: + list[~azure.mgmt.servicefabricmanagedclusters.models.LoadBalancingRule] + :ivar allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG rule + opens RDP port to Internet which can be overridden with custom Network Security Rules. The default value for this setting is false. - :type allow_rdp_access: bool - :param network_security_rules: Custom Network Security Rules that are applied to the virtual - network of the cluster. - :type network_security_rules: - list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] - :param clients: Client certificates that are allowed to manage the cluster. - :type clients: - list[~service_fabric_managed_clusters_management_client.models.ClientCertificate] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: - ~service_fabric_managed_clusters_management_client.models.AzureActiveDirectory - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: - list[~service_fabric_managed_clusters_management_client.models.SettingsSectionDescription] - :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible - values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", - "Deleting", "Deleted", "Other". + :vartype allow_rdp_access: bool + :ivar network_security_rules: Custom Network Security Rules that are applied to the Virtual + Network of the cluster. + :vartype network_security_rules: + list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] + :ivar clients: Client certificates that are allowed to manage the cluster. + :vartype clients: list[~azure.mgmt.servicefabricmanagedclusters.models.ClientCertificate] + :ivar azure_active_directory: The AAD authentication settings of the cluster. + :vartype azure_active_directory: + ~azure.mgmt.servicefabricmanagedclusters.models.AzureActiveDirectory + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. + :vartype fabric_settings: + list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsSectionDescription] + :ivar provisioning_state: The provisioning state of the managed cluster resource. Known values + are: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", + "Deleted", and "Other". :vartype provisioning_state: str or - ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - is required when **clusterUpgradeMode** is set to 'Manual'. To get list of available Service + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property is + required when **clusterUpgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :param cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime - version is available. Possible values include: "Automatic", "Manual". Default value: - "Automatic". - :type cluster_upgrade_mode: str or - ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeMode - :param cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be + :vartype cluster_code_version: str + :ivar cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime + version is available. Known values are: "Automatic" and "Manual". + :vartype cluster_upgrade_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode + :ivar cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** - is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type cluster_upgrade_cadence: str or - ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeCadence - :param addon_features: List of add-on features to enable on the cluster. - :type addon_features: list[str or - ~service_fabric_managed_clusters_management_client.models.ManagedClusterAddOnFeature] - :param enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node - types that are created using any platform OS image with version 'latest'. The default value for + is set to 'Automatic'. Known values are: "Wave0", "Wave1", and "Wave2". + :vartype cluster_upgrade_cadence: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence + :ivar addon_features: List of add-on features to enable on the cluster. + :vartype addon_features: list[str or + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterAddOnFeature] + :ivar enable_auto_os_upgrade: Enables automatic OS upgrade for node types created using OS + images with version 'latest'. The default value for this setting is false. + :vartype enable_auto_os_upgrade: bool + :ivar zonal_resiliency: Indicates if the cluster has zone resiliency. + :vartype zonal_resiliency: bool + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionsCleanupPolicy + :ivar enable_ipv6: Setting this to true creates IPv6 address space for the default VNet used by + the cluster. This setting cannot be changed once the cluster is created. The default value for this setting is false. - :type enable_auto_os_upgrade: bool - :param zonal_resiliency: Indicates if the cluster has zone resiliency. - :type zonal_resiliency: bool - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: - ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionsCleanupPolicy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "system_data": {"readonly": True}, - "fqdn": {"readonly": True}, - "ipv4_address": {"readonly": True}, - "cluster_id": {"readonly": True}, - "cluster_state": {"readonly": True}, - "cluster_certificate_thumbprints": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "sku": {"key": "sku", "type": "Sku"}, - "dns_name": {"key": "properties.dnsName", "type": "str"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "ipv4_address": {"key": "properties.ipv4Address", "type": "str"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "cluster_state": {"key": "properties.clusterState", "type": "str"}, - "cluster_certificate_thumbprints": {"key": "properties.clusterCertificateThumbprints", "type": "[str]"}, - "client_connection_port": {"key": "properties.clientConnectionPort", "type": "int"}, - "http_gateway_connection_port": {"key": "properties.httpGatewayConnectionPort", "type": "int"}, - "admin_user_name": {"key": "properties.adminUserName", "type": "str"}, - "admin_password": {"key": "properties.adminPassword", "type": "str"}, - "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[LoadBalancingRule]"}, - "allow_rdp_access": {"key": "properties.allowRdpAccess", "type": "bool"}, - "network_security_rules": {"key": "properties.networkSecurityRules", "type": "[NetworkSecurityRule]"}, - "clients": {"key": "properties.clients", "type": "[ClientCertificate]"}, - "azure_active_directory": {"key": "properties.azureActiveDirectory", "type": "AzureActiveDirectory"}, - "fabric_settings": {"key": "properties.fabricSettings", "type": "[SettingsSectionDescription]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_code_version": {"key": "properties.clusterCodeVersion", "type": "str"}, - "cluster_upgrade_mode": {"key": "properties.clusterUpgradeMode", "type": "str"}, - "cluster_upgrade_cadence": {"key": "properties.clusterUpgradeCadence", "type": "str"}, - "addon_features": {"key": "properties.addonFeatures", "type": "[str]"}, - "enable_auto_os_upgrade": {"key": "properties.enableAutoOSUpgrade", "type": "bool"}, - "zonal_resiliency": {"key": "properties.zonalResiliency", "type": "bool"}, - "application_type_versions_cleanup_policy": { - "key": "properties.applicationTypeVersionsCleanupPolicy", - "type": "ApplicationTypeVersionsCleanupPolicy", - }, - } - - def __init__(self, **kwargs): - super(ManagedCluster, self).__init__(**kwargs) - self.sku = kwargs.get("sku", None) - self.dns_name = kwargs.get("dns_name", None) - self.fqdn = None - self.ipv4_address = None - self.cluster_id = None - self.cluster_state = None - self.cluster_certificate_thumbprints = None - self.client_connection_port = kwargs.get("client_connection_port", 19000) - self.http_gateway_connection_port = kwargs.get("http_gateway_connection_port", 19080) - self.admin_user_name = kwargs.get("admin_user_name", None) - self.admin_password = kwargs.get("admin_password", None) - self.load_balancing_rules = kwargs.get("load_balancing_rules", None) - self.allow_rdp_access = kwargs.get("allow_rdp_access", None) - self.network_security_rules = kwargs.get("network_security_rules", None) - self.clients = kwargs.get("clients", None) - self.azure_active_directory = kwargs.get("azure_active_directory", None) - self.fabric_settings = kwargs.get("fabric_settings", None) - self.provisioning_state = None - self.cluster_code_version = kwargs.get("cluster_code_version", None) - self.cluster_upgrade_mode = kwargs.get("cluster_upgrade_mode", "Automatic") - self.cluster_upgrade_cadence = kwargs.get("cluster_upgrade_cadence", None) - self.addon_features = kwargs.get("addon_features", None) - self.enable_auto_os_upgrade = kwargs.get("enable_auto_os_upgrade", None) - self.zonal_resiliency = kwargs.get("zonal_resiliency", False) - self.application_type_versions_cleanup_policy = kwargs.get("application_type_versions_cleanup_policy", None) - - -class ManagedClusterCodeVersionResult(msrest.serialization.Model): - """The result of the Service Fabric runtime versions. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param id: The identification of the result. - :type id: str - :param name: The name of the result. - :type name: str - :param type: The result resource type. - :type type: str - :param cluster_code_version: The Service Fabric runtime version of the cluster. - :type cluster_code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :ivar os_type: Cluster operating system, the default will be Windows. Default value: "Windows". - :vartype os_type: str + :vartype enable_ipv6: bool + :ivar subnet_id: If specified, the node types for the cluster are created in this subnet + instead of the default VNet. The **networkSecurityRules** specified for the cluster are also + applied to this subnet. This setting cannot be changed once the cluster is created. + :vartype subnet_id: str + :ivar ip_tags: The list of IP tags associated with the default public IP address of the + cluster. + :vartype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] + :ivar ipv6_address: IPv6 address for the cluster if IPv6 is enabled. + :vartype ipv6_address: str + :ivar enable_service_public_ip: Setting this to true will link the IPv4 address as the + ServicePublicIP of the IPv6 address. It can only be set to True if IPv6 is enabled on the + cluster. + :vartype enable_service_public_ip: bool + :ivar auxiliary_subnets: Auxiliary subnets for the cluster. + :vartype auxiliary_subnets: list[~azure.mgmt.servicefabricmanagedclusters.models.Subnet] + :ivar service_endpoints: Service endpoints for subnets in the cluster. + :vartype service_endpoints: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceEndpoint] + :ivar zonal_update_mode: Indicates the update mode for Cross Az clusters. Known values are: + "Standard" and "Fast". + :vartype zonal_update_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ZonalUpdateMode + :ivar use_custom_vnet: For new clusters, this parameter indicates that it uses Bring your own + VNet, but the subnet is specified at node type level; and for such clusters, the subnetId + property is required for node types. + :vartype use_custom_vnet: bool + :ivar public_ip_prefix_id: Specify the resource id of a public IPv4 prefix that the load + balancer will allocate a public IPv4 address from. This setting cannot be changed once the + cluster is created. + :vartype public_ip_prefix_id: str + :ivar public_i_pv6_prefix_id: Specify the resource id of a public IPv6 prefix that the load + balancer will allocate a public IPv6 address from. This setting cannot be changed once the + cluster is created. + :vartype public_i_pv6_prefix_id: str + :ivar ddos_protection_plan_id: Specify the resource id of a DDoS network protection plan that + will be associated with the virtual network of the cluster. + :vartype ddos_protection_plan_id: str + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: + ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy + :ivar http_gateway_token_auth_connection_port: The port used for token-auth based HTTPS + connections to the cluster. Cannot be set to the same port as HttpGatewayEndpoint. + :vartype http_gateway_token_auth_connection_port: int + :ivar enable_http_gateway_exclusive_auth_mode: If true, token-based authentication is not + allowed on the HttpGatewayEndpoint. This is required to support TLS versions 1.3 and above. If + token-based authentication is used, HttpGatewayTokenAuthConnectionPort must be defined. + :vartype enable_http_gateway_exclusive_auth_mode: bool + :ivar auto_generated_domain_name_label_scope: This property is the entry point to using a + public CA cert for your cluster cert. It specifies the level of reuse allowed for the custom + FQDN created, matching the subject of the public CA cert. Known values are: "TenantReuse", + "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". + :vartype auto_generated_domain_name_label_scope: str or + ~azure.mgmt.servicefabricmanagedclusters.models.AutoGeneratedDomainNameLabelScope + :ivar allocated_outbound_ports: The number of outbound ports allocated for SNAT for each node + in the backend pool of the default load balancer. The default value is 0 which provides dynamic + port allocation based on pool size. + :vartype allocated_outbound_ports: int + :ivar vm_image: The VM image the node types are configured with. This property controls the + Service Fabric component packages to be used for the cluster. Allowed values are: 'Windows'. + The default value is 'Windows'. + :vartype vm_image: str """ - _validation = { - "os_type": {"constant": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "cluster_code_version": {"key": "properties.clusterCodeVersion", "type": "str"}, - "support_expiry_utc": {"key": "properties.supportExpiryUtc", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - } - - os_type = "Windows" - - def __init__(self, **kwargs): - super(ManagedClusterCodeVersionResult, self).__init__(**kwargs) - self.id = kwargs.get("id", None) - self.name = kwargs.get("name", None) - self.type = kwargs.get("type", None) - self.cluster_code_version = kwargs.get("cluster_code_version", None) - self.support_expiry_utc = kwargs.get("support_expiry_utc", None) - - -class ManagedClusterListResult(msrest.serialization.Model): - """Managed Cluster list results. + dns_name: str = rest_field(name="dnsName", visibility=["read", "create", "update", "delete", "query"]) + """The cluster dns name. Required.""" + fqdn: Optional[str] = rest_field(visibility=["read"]) + """The fully qualified domain name associated with the public load balancer of the cluster.""" + ipv4_address: Optional[str] = rest_field(name="ipv4Address", visibility=["read"]) + """The IPv4 address associated with the public load balancer of the cluster.""" + cluster_id: Optional[str] = rest_field(name="clusterId", visibility=["read"]) + """A service generated unique identifier for the cluster resource.""" + cluster_state: Optional[Union[str, "_models.ClusterState"]] = rest_field(name="clusterState", visibility=["read"]) + """The current state of the cluster. Known values are: \"WaitingForNodes\", \"Deploying\", + \"BaselineUpgrade\", \"Upgrading\", \"UpgradeFailed\", and \"Ready\".""" + cluster_certificate_thumbprints: Optional[List[str]] = rest_field( + name="clusterCertificateThumbprints", visibility=["read"] + ) + """List of thumbprints of the cluster certificates.""" + client_connection_port: Optional[int] = rest_field( + name="clientConnectionPort", visibility=["read", "create", "update", "delete", "query"] + ) + """The port used for client connections to the cluster.""" + http_gateway_connection_port: Optional[int] = rest_field( + name="httpGatewayConnectionPort", visibility=["read", "create", "update", "delete", "query"] + ) + """The port used for HTTP connections to the cluster.""" + admin_user_name: str = rest_field(name="adminUserName", visibility=["read", "create", "update", "delete", "query"]) + """VM admin user name. Required.""" + admin_password: Optional[str] = rest_field( + name="adminPassword", visibility=["read", "create", "update", "delete", "query"] + ) + """VM admin user password.""" + load_balancing_rules: Optional[List["_models.LoadBalancingRule"]] = rest_field( + name="loadBalancingRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Load balancing rules that are applied to the public load balancer of the cluster.""" + allow_rdp_access: Optional[bool] = rest_field( + name="allowRdpAccess", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this to true enables RDP access to the VM. The default NSG rule opens RDP port to + Internet which can be overridden with custom Network Security Rules. The default value for this + setting is false.""" + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = rest_field( + name="networkSecurityRules", visibility=["read", "create", "update", "delete", "query"] + ) + """Custom Network Security Rules that are applied to the Virtual Network of the cluster.""" + clients: Optional[List["_models.ClientCertificate"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Client certificates that are allowed to manage the cluster.""" + azure_active_directory: Optional["_models.AzureActiveDirectory"] = rest_field( + name="azureActiveDirectory", visibility=["read", "create", "update", "delete", "query"] + ) + """The AAD authentication settings of the cluster.""" + fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = rest_field( + name="fabricSettings", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of custom fabric settings to configure the cluster.""" + provisioning_state: Optional[Union[str, "_models.ManagedResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the managed cluster resource. Known values are: \"None\", + \"Creating\", \"Created\", \"Updating\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleting\", + \"Deleted\", and \"Other\".""" + cluster_code_version: Optional[str] = rest_field( + name="clusterCodeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Service Fabric runtime version of the cluster. This property is required when + **clusterUpgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for + new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available + version for existing clusters use **availableClusterVersions**.""" + cluster_upgrade_mode: Optional[Union[str, "_models.ClusterUpgradeMode"]] = rest_field( + name="clusterUpgradeMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The upgrade mode of the cluster when new Service Fabric runtime version is available. Known + values are: \"Automatic\" and \"Manual\".""" + cluster_upgrade_cadence: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = rest_field( + name="clusterUpgradeCadence", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates when new cluster runtime version upgrades will be applied after they are released. By + default is Wave0. Only applies when **clusterUpgradeMode** is set to 'Automatic'. Known values + are: \"Wave0\", \"Wave1\", and \"Wave2\".""" + addon_features: Optional[List[Union[str, "_models.ManagedClusterAddOnFeature"]]] = rest_field( + name="addonFeatures", visibility=["read", "create", "update", "delete", "query"] + ) + """List of add-on features to enable on the cluster.""" + enable_auto_os_upgrade: Optional[bool] = rest_field( + name="enableAutoOSUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """Enables automatic OS upgrade for node types created using OS images with version 'latest'. The + default value for this setting is false.""" + zonal_resiliency: Optional[bool] = rest_field( + name="zonalResiliency", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if the cluster has zone resiliency.""" + application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = rest_field( + name="applicationTypeVersionsCleanupPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy used to clean up unused versions.""" + enable_ipv6: Optional[bool] = rest_field( + name="enableIpv6", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this to true creates IPv6 address space for the default VNet used by the cluster. This + setting cannot be changed once the cluster is created. The default value for this setting is + false.""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + """If specified, the node types for the cluster are created in this subnet instead of the default + VNet. The **networkSecurityRules** specified for the cluster are also applied to this subnet. + This setting cannot be changed once the cluster is created.""" + ip_tags: Optional[List["_models.IpTag"]] = rest_field( + name="ipTags", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of IP tags associated with the default public IP address of the cluster.""" + ipv6_address: Optional[str] = rest_field(name="ipv6Address", visibility=["read"]) + """IPv6 address for the cluster if IPv6 is enabled.""" + enable_service_public_ip: Optional[bool] = rest_field( + name="enableServicePublicIP", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this to true will link the IPv4 address as the ServicePublicIP of the IPv6 address. It + can only be set to True if IPv6 is enabled on the cluster.""" + auxiliary_subnets: Optional[List["_models.Subnet"]] = rest_field( + name="auxiliarySubnets", visibility=["read", "create", "update", "delete", "query"] + ) + """Auxiliary subnets for the cluster.""" + service_endpoints: Optional[List["_models.ServiceEndpoint"]] = rest_field( + name="serviceEndpoints", visibility=["read", "create", "update", "delete", "query"] + ) + """Service endpoints for subnets in the cluster.""" + zonal_update_mode: Optional[Union[str, "_models.ZonalUpdateMode"]] = rest_field( + name="zonalUpdateMode", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the update mode for Cross Az clusters. Known values are: \"Standard\" and \"Fast\".""" + use_custom_vnet: Optional[bool] = rest_field( + name="useCustomVnet", visibility=["read", "create", "update", "delete", "query"] + ) + """For new clusters, this parameter indicates that it uses Bring your own VNet, but the subnet is + specified at node type level; and for such clusters, the subnetId property is required for node + types.""" + public_ip_prefix_id: Optional[str] = rest_field( + name="publicIPPrefixId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify the resource id of a public IPv4 prefix that the load balancer will allocate a public + IPv4 address from. This setting cannot be changed once the cluster is created.""" + public_i_pv6_prefix_id: Optional[str] = rest_field( + name="publicIPv6PrefixId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify the resource id of a public IPv6 prefix that the load balancer will allocate a public + IPv6 address from. This setting cannot be changed once the cluster is created.""" + ddos_protection_plan_id: Optional[str] = rest_field( + name="ddosProtectionPlanId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specify the resource id of a DDoS network protection plan that will be associated with the + virtual network of the cluster.""" + upgrade_description: Optional["_models.ClusterUpgradePolicy"] = rest_field( + name="upgradeDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """The policy to use when upgrading the cluster.""" + http_gateway_token_auth_connection_port: Optional[int] = rest_field( + name="httpGatewayTokenAuthConnectionPort", visibility=["read", "create", "update", "delete", "query"] + ) + """The port used for token-auth based HTTPS connections to the cluster. Cannot be set to the same + port as HttpGatewayEndpoint.""" + enable_http_gateway_exclusive_auth_mode: Optional[bool] = rest_field( + name="enableHttpGatewayExclusiveAuthMode", visibility=["read", "create", "update", "delete", "query"] + ) + """If true, token-based authentication is not allowed on the HttpGatewayEndpoint. This is required + to support TLS versions 1.3 and above. If token-based authentication is used, + HttpGatewayTokenAuthConnectionPort must be defined.""" + auto_generated_domain_name_label_scope: Optional[Union[str, "_models.AutoGeneratedDomainNameLabelScope"]] = ( + rest_field(name="autoGeneratedDomainNameLabelScope", visibility=["read", "create", "update", "delete", "query"]) + ) + """This property is the entry point to using a public CA cert for your cluster cert. It specifies + the level of reuse allowed for the custom FQDN created, matching the subject of the public CA + cert. Known values are: \"TenantReuse\", \"SubscriptionReuse\", \"ResourceGroupReuse\", and + \"NoReuse\".""" + allocated_outbound_ports: Optional[int] = rest_field( + name="allocatedOutboundPorts", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of outbound ports allocated for SNAT for each node in the backend pool of the + default load balancer. The default value is 0 which provides dynamic port allocation based on + pool size.""" + vm_image: Optional[str] = rest_field(name="VMImage", visibility=["read", "create", "update", "delete", "query"]) + """The VM image the node types are configured with. This property controls the Service Fabric + component packages to be used for the cluster. Allowed values are: 'Windows'. The default value + is 'Windows'.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + dns_name: str, + admin_user_name: str, + client_connection_port: Optional[int] = None, + http_gateway_connection_port: Optional[int] = None, + admin_password: Optional[str] = None, + load_balancing_rules: Optional[List["_models.LoadBalancingRule"]] = None, + allow_rdp_access: Optional[bool] = None, + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, + clients: Optional[List["_models.ClientCertificate"]] = None, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = None, + cluster_code_version: Optional[str] = None, + cluster_upgrade_mode: Optional[Union[str, "_models.ClusterUpgradeMode"]] = None, + cluster_upgrade_cadence: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = None, + addon_features: Optional[List[Union[str, "_models.ManagedClusterAddOnFeature"]]] = None, + enable_auto_os_upgrade: Optional[bool] = None, + zonal_resiliency: Optional[bool] = None, + application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = None, + enable_ipv6: Optional[bool] = None, + subnet_id: Optional[str] = None, + ip_tags: Optional[List["_models.IpTag"]] = None, + enable_service_public_ip: Optional[bool] = None, + auxiliary_subnets: Optional[List["_models.Subnet"]] = None, + service_endpoints: Optional[List["_models.ServiceEndpoint"]] = None, + zonal_update_mode: Optional[Union[str, "_models.ZonalUpdateMode"]] = None, + use_custom_vnet: Optional[bool] = None, + public_ip_prefix_id: Optional[str] = None, + public_i_pv6_prefix_id: Optional[str] = None, + ddos_protection_plan_id: Optional[str] = None, + upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, + http_gateway_token_auth_connection_port: Optional[int] = None, + enable_http_gateway_exclusive_auth_mode: Optional[bool] = None, + auto_generated_domain_name_label_scope: Optional[ + Union[str, "_models.AutoGeneratedDomainNameLabelScope"] + ] = None, + allocated_outbound_ports: Optional[int] = None, + vm_image: 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 ManagedClusterUpdateParameters(_Model): + """Managed cluster update request. - :param value: - :type value: list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar tags: Managed cluster update parameters. + :vartype tags: dict[str, str] """ - _attribute_map = { - "value": {"key": "value", "type": "[ManagedCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Managed cluster update parameters.""" - def __init__(self, **kwargs): - super(ManagedClusterListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = kwargs.get("next_link", None) + @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] + """ -class ManagedClusterUpdateParameters(msrest.serialization.Model): - """Managed cluster update request. - - :param tags: A set of tags. Managed cluster update parameters. - :type tags: dict[str, str] - """ + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - def __init__(self, **kwargs): - super(ManagedClusterUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", None) +class ManagedClusterVersionDetails(_Model): + """The detail of the Service Fabric runtime version result. + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. + :vartype cluster_code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: ~datetime.datetime + :ivar os_type: Cluster operating system, the default will be Windows. "Windows" + :vartype os_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.OsType + """ -class ManagedIdentity(msrest.serialization.Model): + cluster_code_version: Optional[str] = rest_field( + name="clusterCodeVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The Service Fabric runtime version of the cluster.""" + support_expiry_utc: Optional[datetime.datetime] = rest_field( + name="supportExpiryUtc", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The date of expiry of support of the version.""" + os_type: Optional[Union[str, "_models.OsType"]] = rest_field( + name="osType", visibility=["read", "create", "update", "delete", "query"] + ) + """Cluster operating system, the default will be Windows. \"Windows\"""" + + @overload + def __init__( + self, + *, + cluster_code_version: Optional[str] = None, + support_expiry_utc: Optional[datetime.datetime] = None, + os_type: Optional[Union[str, "_models.OsType"]] = 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 ManagedIdentity(_Model): """Describes the managed identities for an Azure resource. - Variables are only populated by the server, and will be ignored when sending a request. - :ivar principal_id: The principal id of the managed identity. This property will only be provided for a system assigned identity. :vartype principal_id: str :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of managed identity for the resource. Possible values include: "None", - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar type: The type of managed identity for the resource. Known values are: "None", + "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". + :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~service_fabric_managed_clusters_management_client.models.UserAssignedIdentity] + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.servicefabricmanagedclusters.models.UserAssignedIdentity] """ - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__(self, **kwargs): - super(ManagedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get("type", None) - self.user_assigned_identities = kwargs.get("user_assigned_identities", None) - - -class ManagedProxyResource(msrest.serialization.Model): - """The resource model definition for proxy-only resource. - - Variables are only populated by the server, and will be ignored when sending a request. + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of the managed identity. This property will only be provided for a system + assigned identity.""" + tenant_id: Optional[str] = rest_field(name="tenantId", visibility=["read"]) + """The tenant id of the managed identity. This property will only be provided for a system + assigned identity.""" + type: Optional[Union[str, "_models.ManagedIdentityType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of managed identity for the resource. Known values are: \"None\", \"SystemAssigned\", + \"UserAssigned\", and \"SystemAssigned, UserAssigned\".""" + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user identities associated with the resource. The user identity dictionary key + references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" + + @overload + def __init__( + self, + *, + type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = 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 ManagedMaintenanceWindowStatus(_Model): + """Describes the maintenance window status of the Service Fabric Managed Cluster. + + :ivar is_window_enabled: If maintenance window is enabled on this cluster. + :vartype is_window_enabled: bool + :ivar is_region_ready: Indicates if the region is ready to configure maintenance windows. + :vartype is_region_ready: bool + :ivar is_window_active: If maintenance window is active. + :vartype is_window_active: bool + :ivar can_apply_updates: If updates can be applied. + :vartype can_apply_updates: bool + :ivar last_window_status_update_at_utc: Last window update time in UTC. + :vartype last_window_status_update_at_utc: ~datetime.datetime + :ivar last_window_start_time_utc: Last window start time in UTC. + :vartype last_window_start_time_utc: ~datetime.datetime + :ivar last_window_end_time_utc: Last window end time in UTC. + :vartype last_window_end_time_utc: ~datetime.datetime + """ - :ivar id: Azure resource identifier. + is_window_enabled: Optional[bool] = rest_field(name="isWindowEnabled", visibility=["read"]) + """If maintenance window is enabled on this cluster.""" + is_region_ready: Optional[bool] = rest_field(name="isRegionReady", visibility=["read"]) + """Indicates if the region is ready to configure maintenance windows.""" + is_window_active: Optional[bool] = rest_field(name="isWindowActive", visibility=["read"]) + """If maintenance window is active.""" + can_apply_updates: Optional[bool] = rest_field(name="canApplyUpdates", visibility=["read"]) + """If updates can be applied.""" + last_window_status_update_at_utc: Optional[datetime.datetime] = rest_field( + name="lastWindowStatusUpdateAtUTC", visibility=["read"], format="rfc3339" + ) + """Last window update time in UTC.""" + last_window_start_time_utc: Optional[datetime.datetime] = rest_field( + name="lastWindowStartTimeUTC", visibility=["read"], format="rfc3339" + ) + """Last window start time in UTC.""" + last_window_end_time_utc: Optional[datetime.datetime] = rest_field( + name="lastWindowEndTimeUTC", visibility=["read"], format="rfc3339" + ) + """Last window end time in UTC.""" + + +class ManagedVMSize(_Model): + """Describes a VM Sizes. + + :ivar properties: VM Size properties. + :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.VMSize + :ivar id: VM Size id. :vartype id: str - :ivar name: Azure resource name. + :ivar name: VM Size name. :vartype name: str - :ivar type: Azure resource type. + :ivar type: VM Size type. :vartype type: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.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"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs): - super(ManagedProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get("tags", None) - self.system_data = None - - -class Partition(msrest.serialization.Model): - """Describes how the service is partitioned. + """ - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: NamedPartitionScheme, SingletonPartitionScheme, UniformInt64RangePartitionScheme. + properties: Optional["_models.VMSize"] = rest_field(visibility=["read"]) + """VM Size properties.""" + id: Optional[str] = rest_field(visibility=["read"]) + """VM Size id.""" + name: Optional[str] = rest_field(visibility=["read"]) + """VM Size name.""" + type: Optional[str] = rest_field(visibility=["read"]) + """VM Size type.""" - All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or - ~service_fabric_managed_clusters_management_client.models.PartitionScheme +class Partition(_Model): + """Describes how the service is partitioned. + + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + NamedPartitionScheme, SingletonPartitionScheme, UniformInt64RangePartitionScheme + + :ivar partition_scheme: Required. Known values are: "Singleton", "UniformInt64Range", and + "Named". + :vartype partition_scheme: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme """ - _validation = { - "partition_scheme": {"required": True}, - } + __mapping__: Dict[str, _Model] = {} + partition_scheme: str = rest_discriminator( + name="partitionScheme", visibility=["read", "create", "update", "delete", "query"] + ) + """Required. Known values are: \"Singleton\", \"UniformInt64Range\", and \"Named\".""" - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - } + @overload + def __init__( + self, + *, + partition_scheme: str, + ) -> None: ... - _subtype_map = { - "partition_scheme": { - "Named": "NamedPartitionScheme", - "Singleton": "SingletonPartitionScheme", - "UniformInt64Range": "UniformInt64RangePartitionScheme", - } - } + @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, **kwargs): - super(Partition, self).__init__(**kwargs) - self.partition_scheme = None # type: Optional[str] + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class NamedPartitionScheme(Partition): +class NamedPartitionScheme(Partition, discriminator="Named"): """Describes the named partition scheme of the service. - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or - ~service_fabric_managed_clusters_management_client.models.PartitionScheme - :param names: Required. Array for the names of the partitions. - :type names: list[str] + :ivar names: Array for the names of the partitions. Required. + :vartype names: list[str] + :ivar partition_scheme: Specifies how the service is partitioned. Required. Indicates that the + partition is based on string names, and is a NamedPartitionScheme object. The value is 2. + :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.NAMED """ - _validation = { - "partition_scheme": {"required": True}, - "names": {"required": True}, - } + names: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Array for the names of the partitions. Required.""" + partition_scheme: Literal[PartitionScheme.NAMED] = rest_discriminator(name="partitionScheme", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies how the service is partitioned. Required. Indicates that the partition is based on + string names, and is a NamedPartitionScheme object. The value is 2.""" - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - "names": {"key": "names", "type": "[str]"}, - } + @overload + def __init__( + self, + *, + names: List[str], + ) -> None: ... - def __init__(self, **kwargs): - super(NamedPartitionScheme, self).__init__(**kwargs) - self.partition_scheme = "Named" # type: str - self.names = kwargs["names"] + @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, partition_scheme=PartitionScheme.NAMED, **kwargs) -class NetworkSecurityRule(msrest.serialization.Model): + +class NetworkSecurityRule(_Model): """Describes a network security rule. - All required parameters must be populated in order to send to Azure. - - :param name: Required. Network security rule name. - :type name: str - :param description: Network security rule description. - :type description: str - :param protocol: Required. Network protocol this rule applies to. Possible values include: - "http", "https", "tcp", "udp", "icmp", "ah", "esp". - :type protocol: str or ~service_fabric_managed_clusters_management_client.models.NsgProtocol - :param source_address_prefixes: The CIDR or source IP ranges. - :type source_address_prefixes: list[str] - :param destination_address_prefixes: The destination address prefixes. CIDR or destination IP + :ivar name: Network security rule name. Required. + :vartype name: str + :ivar description: Network security rule description. + :vartype description: str + :ivar protocol: Network protocol this rule applies to. Required. Known values are: "http", + "https", "tcp", "udp", "icmp", "ah", and "esp". + :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol + :ivar source_address_prefixes: The CIDR or source IP ranges. + :vartype source_address_prefixes: list[str] + :ivar destination_address_prefixes: The destination address prefixes. CIDR or destination IP ranges. - :type destination_address_prefixes: list[str] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Required. The network traffic is allowed or denied. Possible values include: - "allow", "deny". - :type access: str or ~service_fabric_managed_clusters_management_client.models.Access - :param priority: Required. The priority of the rule. The value can be in the range 1000 to - 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource - Provider. The priority number must be unique for each rule in the collection. The lower the - priority number, the higher the priority of the rule. - :type priority: int - :param direction: Required. Network security rule direction. Possible values include: - "inbound", "outbound". - :type direction: str or ~service_fabric_managed_clusters_management_client.models.Direction - """ - - _validation = { - "name": {"required": True}, - "protocol": {"required": True}, - "access": {"required": True}, - "priority": {"required": True, "maximum": 3000, "minimum": 1000}, - "direction": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "protocol": {"key": "protocol", "type": "str"}, - "source_address_prefixes": {"key": "sourceAddressPrefixes", "type": "[str]"}, - "destination_address_prefixes": {"key": "destinationAddressPrefixes", "type": "[str]"}, - "source_port_ranges": {"key": "sourcePortRanges", "type": "[str]"}, - "destination_port_ranges": {"key": "destinationPortRanges", "type": "[str]"}, - "access": {"key": "access", "type": "str"}, - "priority": {"key": "priority", "type": "int"}, - "direction": {"key": "direction", "type": "str"}, - } - - def __init__(self, **kwargs): - super(NetworkSecurityRule, self).__init__(**kwargs) - self.name = kwargs["name"] - self.description = kwargs.get("description", None) - self.protocol = kwargs["protocol"] - self.source_address_prefixes = kwargs.get("source_address_prefixes", None) - self.destination_address_prefixes = kwargs.get("destination_address_prefixes", None) - self.source_port_ranges = kwargs.get("source_port_ranges", None) - self.destination_port_ranges = kwargs.get("destination_port_ranges", None) - self.access = kwargs["access"] - self.priority = kwargs["priority"] - self.direction = kwargs["direction"] - - -class NodeType(ManagedProxyResource): - """Describes a node type in the cluster, each node type represents sub set of nodes in the cluster. - - Variables are only populated by the server, and will be ignored when sending a request. + :vartype destination_address_prefixes: list[str] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used. If this is an ingress rule, specifies where network traffic originates from. + :vartype source_address_prefix: str + :ivar destination_address_prefix: The destination address prefix. CIDR or destination IP range. + Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', + 'AzureLoadBalancer' and 'Internet' can also be used. + :vartype destination_address_prefix: str + :ivar source_port_range: The source port or range. Integer or range between 0 and 65535. + Asterisk '*' can also be used to match all ports. + :vartype source_port_range: str + :ivar destination_port_range: he destination port or range. Integer or range between 0 and + 65535. Asterisk '*' can also be used to match all ports. + :vartype destination_port_range: str + :ivar access: The network traffic is allowed or denied. Required. Known values are: "allow" and + "deny". + :vartype access: str or ~azure.mgmt.servicefabricmanagedclusters.models.Access + :ivar priority: The priority of the rule. The value can be in the range 1000 to 3000. Values + outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The + priority number must be unique for each rule in the collection. The lower the priority number, + the higher the priority of the rule. Required. + :vartype priority: int + :ivar direction: Network security rule direction. Required. Known values are: "inbound" and + "outbound". + :vartype direction: str or ~azure.mgmt.servicefabricmanagedclusters.models.Direction + """ - :ivar id: Azure resource identifier. + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Network security rule name. Required.""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Network security rule description.""" + protocol: Union[str, "_models.NsgProtocol"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Network protocol this rule applies to. Required. Known values are: \"http\", \"https\", + \"tcp\", \"udp\", \"icmp\", \"ah\", and \"esp\".""" + source_address_prefixes: Optional[List[str]] = rest_field( + name="sourceAddressPrefixes", visibility=["read", "create", "update", "delete", "query"] + ) + """The CIDR or source IP ranges.""" + destination_address_prefixes: Optional[List[str]] = rest_field( + name="destinationAddressPrefixes", visibility=["read", "create", "update", "delete", "query"] + ) + """The destination address prefixes. CIDR or destination IP ranges.""" + source_port_ranges: Optional[List[str]] = rest_field( + name="sourcePortRanges", visibility=["read", "create", "update", "delete", "query"] + ) + """The source port ranges.""" + destination_port_ranges: Optional[List[str]] = rest_field( + name="destinationPortRanges", visibility=["read", "create", "update", "delete", "query"] + ) + """The destination port ranges.""" + source_address_prefix: Optional[str] = rest_field( + name="sourceAddressPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The CIDR or source IP range. Asterisk '*' can also be used to match all source IPs. Default + tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. If this is + an ingress rule, specifies where network traffic originates from.""" + destination_address_prefix: Optional[str] = rest_field( + name="destinationAddressPrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """The destination address prefix. CIDR or destination IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used.""" + source_port_range: Optional[str] = rest_field( + name="sourcePortRange", visibility=["read", "create", "update", "delete", "query"] + ) + """The source port or range. Integer or range between 0 and 65535. Asterisk '*' can also be used + to match all ports.""" + destination_port_range: Optional[str] = rest_field( + name="destinationPortRange", visibility=["read", "create", "update", "delete", "query"] + ) + """he destination port or range. Integer or range between 0 and 65535. Asterisk '*' can also be + used to match all ports.""" + access: Union[str, "_models.Access"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The network traffic is allowed or denied. Required. Known values are: \"allow\" and \"deny\".""" + priority: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The priority of the rule. The value can be in the range 1000 to 3000. Values outside this range + are reserved for Service Fabric ManagerCluster Resource Provider. The priority number must be + unique for each rule in the collection. The lower the priority number, the higher the priority + of the rule. Required.""" + direction: Union[str, "_models.Direction"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Network security rule direction. Required. Known values are: \"inbound\" and \"outbound\".""" + + @overload + def __init__( + self, + *, + name: str, + protocol: Union[str, "_models.NsgProtocol"], + access: Union[str, "_models.Access"], + priority: int, + direction: Union[str, "_models.Direction"], + description: Optional[str] = None, + source_address_prefixes: Optional[List[str]] = None, + destination_address_prefixes: Optional[List[str]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + source_address_prefix: Optional[str] = None, + destination_address_prefix: Optional[str] = None, + source_port_range: Optional[str] = None, + destination_port_range: 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 NodeType(ProxyResource): + """Describes a node type in the cluster, each node type represents sub set of nodes in the + cluster. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param is_primary: The node type on which system services will run. Only one node type should - be marked as primary. Primary node type cannot be deleted or changed for existing clusters. - :type is_primary: bool - :param vm_instance_count: The number of nodes in the node type. - :type vm_instance_count: int - :param data_disk_size_gb: Disk size for each vm in the node type in GBs. - :type data_disk_size_gb: int - :param data_disk_type: Managed data disk type. IOPS and throughput are given by the disk size, - to see more information go to - https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types. Possible values include: - "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default value: "StandardSSD_LRS". - :type data_disk_type: str or ~service_fabric_managed_clusters_management_client.models.DiskType - :param placement_properties: The placement tags applied to nodes in the node type, which can be + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar properties: The node type properties. + :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar sku: The node type sku. + :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku + """ + + properties: Optional["_models.NodeTypeProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The node type properties.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + sku: Optional["_models.NodeTypeSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The node type sku.""" + + __flattened_items = [ + "is_primary", + "vm_instance_count", + "data_disk_size_gb", + "data_disk_type", + "data_disk_letter", + "placement_properties", + "capacities", + "application_ports", + "ephemeral_ports", + "vm_size", + "vm_image_publisher", + "vm_image_offer", + "vm_image_sku", + "vm_image_version", + "vm_secrets", + "vm_extensions", + "vm_managed_identity", + "is_stateless", + "multiple_placement_groups", + "frontend_configurations", + "network_security_rules", + "additional_data_disks", + "enable_encryption_at_host", + "provisioning_state", + "enable_accelerated_networking", + "use_default_public_load_balancer", + "use_temp_data_disk", + "enable_over_provisioning", + "zones", + "is_spot_vm", + "host_group_id", + "use_ephemeral_os_disk", + "spot_restore_timeout", + "eviction_policy", + "vm_image_resource_id", + "subnet_id", + "vm_setup_actions", + "security_type", + "security_encryption_type", + "secure_boot_enabled", + "enable_node_public_ip", + "enable_node_public_i_pv6", + "vm_shared_gallery_image_id", + "nat_gateway_id", + "nat_configurations", + "vm_image_plan", + "service_artifact_reference_id", + "dscp_configuration_id", + "additional_network_interface_configurations", + "computer_name_prefix", + "vm_applications", + "zone_balance", + ] + + @overload + def __init__( + self, + *, + properties: Optional["_models.NodeTypeProperties"] = None, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.NodeTypeSku"] = 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 NodeTypeActionParameters(_Model): + """Parameters for Node type action. If nodes are not specified on the parameters, the operation + will be performed in all nodes of the node type one upgrade domain at a time. + + :ivar nodes: List of node names from the node type. + :vartype nodes: list[str] + :ivar force: Force the action to go through. + :vartype force: bool + :ivar update_type: Specifies the way the operation will be performed. Known values are: + "Default" and "ByUpgradeDomain". + :vartype update_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.UpdateType + """ + + nodes: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """List of node names from the node type.""" + force: Optional[bool] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Force the action to go through.""" + update_type: Optional[Union[str, "_models.UpdateType"]] = rest_field( + name="updateType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the way the operation will be performed. Known values are: \"Default\" and + \"ByUpgradeDomain\".""" + + @overload + def __init__( + self, + *, + nodes: Optional[List[str]] = None, + force: Optional[bool] = None, + update_type: Optional[Union[str, "_models.UpdateType"]] = 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 NodeTypeAvailableSku(_Model): + """Defines the type of sku available for a node type. + + :ivar resource_type: The type of resource the sku applies to. Value: + Microsoft.ServiceFabric/managedClusters/nodeTypes. + :vartype resource_type: str + :ivar sku: The supported SKU for a for node type. + :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSupportedSku + :ivar capacity: Provides information about how the node count can be scaled. + :vartype capacity: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuCapacity + """ + + resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"]) + """The type of resource the sku applies to. Value: + Microsoft.ServiceFabric/managedClusters/nodeTypes.""" + sku: Optional["_models.NodeTypeSupportedSku"] = rest_field(visibility=["read"]) + """The supported SKU for a for node type.""" + capacity: Optional["_models.NodeTypeSkuCapacity"] = rest_field(visibility=["read"]) + """Provides information about how the node count can be scaled.""" + + +class NodeTypeFaultSimulation(_Model): + """Node type fault simulation object with status. + + :ivar node_type_name: Node type name. + :vartype node_type_name: str + :ivar status: Fault simulation status. Known values are: "Starting", "Active", "Stopping", + "Done", "StartFailed", and "StopFailed". + :vartype status: str or ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationStatus + :ivar operation_id: Current or latest asynchronous operation identifier on the node type. + :vartype operation_id: str + :ivar operation_status: Current or latest asynchronous operation status on the node type. Known + values are: "Created", "Started", "Succeeded", "Failed", "Aborted", and "Canceled". + :vartype operation_status: str or + ~azure.mgmt.servicefabricmanagedclusters.models.SfmcOperationStatus + """ + + node_type_name: Optional[str] = rest_field( + name="nodeTypeName", visibility=["read", "create", "update", "delete", "query"] + ) + """Node type name.""" + status: Optional[Union[str, "_models.FaultSimulationStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Fault simulation status. Known values are: \"Starting\", \"Active\", \"Stopping\", \"Done\", + \"StartFailed\", and \"StopFailed\".""" + operation_id: Optional[str] = rest_field( + name="operationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Current or latest asynchronous operation identifier on the node type.""" + operation_status: Optional[Union[str, "_models.SfmcOperationStatus"]] = rest_field( + name="operationStatus", visibility=["read", "create", "update", "delete", "query"] + ) + """Current or latest asynchronous operation status on the node type. Known values are: + \"Created\", \"Started\", \"Succeeded\", \"Failed\", \"Aborted\", and \"Canceled\".""" + + @overload + def __init__( + self, + *, + node_type_name: Optional[str] = None, + status: Optional[Union[str, "_models.FaultSimulationStatus"]] = None, + operation_id: Optional[str] = None, + operation_status: Optional[Union[str, "_models.SfmcOperationStatus"]] = 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 NodeTypeNatConfig(_Model): + """Provides information about NAT configuration on the default public Load Balancer for the node + type. + + :ivar backend_port: The internal port for the NAT configuration. + :vartype backend_port: int + :ivar frontend_port_range_start: The port range start for the external endpoint. + :vartype frontend_port_range_start: int + :ivar frontend_port_range_end: The port range end for the external endpoint. + :vartype frontend_port_range_end: int + """ + + backend_port: Optional[int] = rest_field( + name="backendPort", visibility=["read", "create", "update", "delete", "query"] + ) + """The internal port for the NAT configuration.""" + frontend_port_range_start: Optional[int] = rest_field( + name="frontendPortRangeStart", visibility=["read", "create", "update", "delete", "query"] + ) + """The port range start for the external endpoint.""" + frontend_port_range_end: Optional[int] = rest_field( + name="frontendPortRangeEnd", visibility=["read", "create", "update", "delete", "query"] + ) + """The port range end for the external endpoint.""" + + @overload + def __init__( + self, + *, + backend_port: Optional[int] = None, + frontend_port_range_start: Optional[int] = None, + frontend_port_range_end: 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 NodeTypeProperties(_Model): + """Describes a node type in the cluster, each node type represents sub set of nodes in the + cluster. + + :ivar is_primary: Indicates the Service Fabric system services for the cluster will run on this + node type. This setting cannot be changed once the node type is created. Required. + :vartype is_primary: bool + :ivar vm_instance_count: The number of nodes in the node type. **Values:** -1 - Use when auto + scale rules are configured or sku.capacity is defined 0 - Not supported >0 - Use for manual + scale. Required. + :vartype vm_instance_count: int + :ivar data_disk_size_gb: Disk size for the managed disk attached to the vms on the node type in + GBs. + :vartype data_disk_size_gb: int + :ivar data_disk_type: Managed data disk type. Specifies the storage account type for the + managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS", + "PremiumV2_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype data_disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType + :ivar data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D and + it can not change after created. + :vartype data_disk_letter: str + :ivar placement_properties: The placement tags applied to nodes in the node type, which can be used to indicate where certain services (workload) should run. - :type placement_properties: dict[str, str] - :param capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :type capacities: dict[str, str] - :param application_ports: The range of ports from which cluster assigned port to Service Fabric + :vartype placement_properties: dict[str, str] + :ivar capacities: The capacity tags applied to the nodes in the node type, the cluster resource + manager uses these tags to understand how much resource a node has. + :vartype capacities: dict[str, str] + :ivar application_ports: The range of ports from which cluster assigned port to Service Fabric applications. - :type application_ports: - ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + :vartype application_ports: + ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription + :ivar ephemeral_ports: The range of ephemeral ports that nodes in this node type should be configured with. - :type ephemeral_ports: - ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription - :param vm_size: The size of virtual machines in the pool. All virtual machines in a pool are - the same size. For example, Standard_D3. - :type vm_size: str - :param vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For + :vartype ephemeral_ports: + ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription + :ivar vm_size: The size of virtual machines in the pool. All virtual machines in a pool are the + same size. For example, Standard_D3. + :vartype vm_size: str + :ivar vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For example, Canonical or MicrosoftWindowsServer. - :type vm_image_publisher: str - :param vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For + :vartype vm_image_publisher: str + :ivar vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For example, UbuntuServer or WindowsServer. - :type vm_image_offer: str - :param vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, + :vartype vm_image_offer: str + :ivar vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, 14.04.0-LTS or 2012-R2-Datacenter. - :type vm_image_sku: str - :param vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value - of 'latest' can be specified to select the latest version of an image. If omitted, the default - is 'latest'. - :type vm_image_version: str - :param vm_secrets: The secrets to install in the virtual machines. - :type vm_secrets: - list[~service_fabric_managed_clusters_management_client.models.VaultSecretGroup] - :param vm_extensions: Set of extensions that should be installed onto the virtual machines. - :type vm_extensions: - list[~service_fabric_managed_clusters_management_client.models.VMSSExtension] - :param vm_managed_identity: Identities for the virtual machine scale set under the node type. - :type vm_managed_identity: - ~service_fabric_managed_clusters_management_client.models.VmManagedIdentity - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_placement_groups: Indicates if scale set associated with the node type can be + :vartype vm_image_sku: str + :ivar vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value of + 'latest' can be specified to select the latest version of an image. If omitted, the default is + 'latest'. + :vartype vm_image_version: str + :ivar vm_secrets: The secrets to install in the virtual machines. + :vartype vm_secrets: list[~azure.mgmt.servicefabricmanagedclusters.models.VaultSecretGroup] + :ivar vm_extensions: Set of extensions that should be installed onto the virtual machines. + :vartype vm_extensions: list[~azure.mgmt.servicefabricmanagedclusters.models.VMSSExtension] + :ivar vm_managed_identity: Identities to assign to the virtual machine scale set under the node + type. + :vartype vm_managed_identity: ~azure.mgmt.servicefabricmanagedclusters.models.VmManagedIdentity + :ivar is_stateless: Indicates if the node type can only host Stateless workloads. + :vartype is_stateless: bool + :ivar multiple_placement_groups: Indicates if scale set associated with the node type can be composed of multiple placement groups. - :type multiple_placement_groups: bool - :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible - values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", - "Deleting", "Deleted", "Other". + :vartype multiple_placement_groups: bool + :ivar frontend_configurations: Indicates the node type uses its own frontend configurations + instead of the default one for the cluster. This setting can only be specified for non-primary + node types and can not be added or removed after the node type is created. + :vartype frontend_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.FrontendConfiguration] + :ivar network_security_rules: The Network Security Rules for this node type. This setting can + only be specified for node types that are configured with frontend configurations. + :vartype network_security_rules: + list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] + :ivar additional_data_disks: Additional managed data disks. + :vartype additional_data_disks: + list[~azure.mgmt.servicefabricmanagedclusters.models.VmssDataDisk] + :ivar enable_encryption_at_host: Enable or disable the Host Encryption for the virtual machines + on the node type. This will enable the encryption for all the disks including Resource/Temp + disk at host itself. Default: The Encryption at host will be disabled unless this property is + set to true for the resource. + :vartype enable_encryption_at_host: bool + :ivar provisioning_state: The provisioning state of the node type resource. Known values are: + "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", + "Deleted", and "Other". :vartype provisioning_state: str or - ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "vm_instance_count": {"maximum": 2147483647, "minimum": 1}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "is_primary": {"key": "properties.isPrimary", "type": "bool"}, - "vm_instance_count": {"key": "properties.vmInstanceCount", "type": "int"}, - "data_disk_size_gb": {"key": "properties.dataDiskSizeGB", "type": "int"}, - "data_disk_type": {"key": "properties.dataDiskType", "type": "str"}, - "placement_properties": {"key": "properties.placementProperties", "type": "{str}"}, - "capacities": {"key": "properties.capacities", "type": "{str}"}, - "application_ports": {"key": "properties.applicationPorts", "type": "EndpointRangeDescription"}, - "ephemeral_ports": {"key": "properties.ephemeralPorts", "type": "EndpointRangeDescription"}, - "vm_size": {"key": "properties.vmSize", "type": "str"}, - "vm_image_publisher": {"key": "properties.vmImagePublisher", "type": "str"}, - "vm_image_offer": {"key": "properties.vmImageOffer", "type": "str"}, - "vm_image_sku": {"key": "properties.vmImageSku", "type": "str"}, - "vm_image_version": {"key": "properties.vmImageVersion", "type": "str"}, - "vm_secrets": {"key": "properties.vmSecrets", "type": "[VaultSecretGroup]"}, - "vm_extensions": {"key": "properties.vmExtensions", "type": "[VMSSExtension]"}, - "vm_managed_identity": {"key": "properties.vmManagedIdentity", "type": "VmManagedIdentity"}, - "is_stateless": {"key": "properties.isStateless", "type": "bool"}, - "multiple_placement_groups": {"key": "properties.multiplePlacementGroups", "type": "bool"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, **kwargs): - super(NodeType, self).__init__(**kwargs) - self.is_primary = kwargs.get("is_primary", None) - self.vm_instance_count = kwargs.get("vm_instance_count", None) - self.data_disk_size_gb = kwargs.get("data_disk_size_gb", None) - self.data_disk_type = kwargs.get("data_disk_type", "StandardSSD_LRS") - self.placement_properties = kwargs.get("placement_properties", None) - self.capacities = kwargs.get("capacities", None) - self.application_ports = kwargs.get("application_ports", None) - self.ephemeral_ports = kwargs.get("ephemeral_ports", None) - self.vm_size = kwargs.get("vm_size", None) - self.vm_image_publisher = kwargs.get("vm_image_publisher", None) - self.vm_image_offer = kwargs.get("vm_image_offer", None) - self.vm_image_sku = kwargs.get("vm_image_sku", None) - self.vm_image_version = kwargs.get("vm_image_version", None) - self.vm_secrets = kwargs.get("vm_secrets", None) - self.vm_extensions = kwargs.get("vm_extensions", None) - self.vm_managed_identity = kwargs.get("vm_managed_identity", None) - self.is_stateless = kwargs.get("is_stateless", False) - self.multiple_placement_groups = kwargs.get("multiple_placement_groups", False) - self.provisioning_state = None - - -class NodeTypeActionParameters(msrest.serialization.Model): - """Parameters for Node type action. - - All required parameters must be populated in order to send to Azure. - - :param nodes: Required. List of node names from the node type. - :type nodes: list[str] - :param force: Force the action to go through. - :type force: bool - """ - - _validation = { - "nodes": {"required": True}, - } - - _attribute_map = { - "nodes": {"key": "nodes", "type": "[str]"}, - "force": {"key": "force", "type": "bool"}, - } - - def __init__(self, **kwargs): - super(NodeTypeActionParameters, self).__init__(**kwargs) - self.nodes = kwargs["nodes"] - self.force = kwargs.get("force", None) - - -class NodeTypeListResult(msrest.serialization.Model): - """Node type list results. - - :param value: The list of node types. - :type value: list[~service_fabric_managed_clusters_management_client.models.NodeType] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NodeType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - super(NodeTypeListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = kwargs.get("next_link", None) - - -class NodeTypeUpdateParameters(msrest.serialization.Model): - """Node type update request. - - :param tags: A set of tags. Node type update parameters. - :type tags: dict[str, str] + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :vartype enable_accelerated_networking: bool + :ivar use_default_public_load_balancer: Specifies whether the use public load balancer. If not + specified and the node type doesn't have its own frontend configuration, it will be attached to + the default load balancer. If the node type uses its own Load balancer and + useDefaultPublicLoadBalancer is true, then the frontend has to be an Internal Load Balancer. If + the node type uses its own Load balancer and useDefaultPublicLoadBalancer is false or not set, + then the custom load balancer must include a public load balancer to provide outbound + connectivity. + :vartype use_default_public_load_balancer: bool + :ivar use_temp_data_disk: Specifies whether to use the temporary disk for the service fabric + data root, in which case no managed data disk will be attached and the temporary disk will be + used. It is only allowed for stateless node types. + :vartype use_temp_data_disk: bool + :ivar enable_over_provisioning: Specifies whether the node type should be overprovisioned. It + is only allowed for stateless node types. + :vartype enable_over_provisioning: bool + :ivar zones: Specifies the availability zones where the node type would span across. If the + cluster is not spanning across availability zones, initiates az migration for the cluster. + :vartype zones: list[str] + :ivar is_spot_vm: Indicates whether the node type will be Spot Virtual Machines. Azure will + allocate the VMs if there is capacity available and the VMs can be evicted at any time. + :vartype is_spot_vm: bool + :ivar host_group_id: Specifies the full host group resource Id. This property is used for + deploying on azure dedicated hosts. + :vartype host_group_id: str + :ivar use_ephemeral_os_disk: Indicates whether to use ephemeral os disk. The sku selected on + the vmSize property needs to support this feature. + :vartype use_ephemeral_os_disk: bool + :ivar spot_restore_timeout: Indicates the time duration after which the platform will not try + to restore the VMSS SPOT instances specified as ISO 8601. + :vartype spot_restore_timeout: str + :ivar eviction_policy: Specifies the eviction policy for virtual machines in a SPOT node type. + Default is Delete. Known values are: "Delete" and "Deallocate". + :vartype eviction_policy: str or + ~azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType + :ivar vm_image_resource_id: Indicates the resource id of the vm image. This parameter is used + for custom vm image. + :vartype vm_image_resource_id: str + :ivar subnet_id: Indicates the resource id of the subnet for the node type. + :vartype subnet_id: str + :ivar vm_setup_actions: Specifies the actions to be performed on the vms before bootstrapping + the service fabric runtime. + :vartype vm_setup_actions: list[str or + ~azure.mgmt.servicefabricmanagedclusters.models.VmSetupAction] + :ivar security_type: Specifies the security type of the nodeType. Supported values include + Standard, TrustedLaunch and ConfidentialVM. Known values are: "TrustedLaunch", "Standard", and + "ConfidentialVM". + :vartype security_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.SecurityType + :ivar security_encryption_type: Specifies the EncryptionType of the managed disk. It is set to + DiskWithVMGuestState for encryption of the managed disk along with VMGuestState blob and + VMGuestStateOnly for encryption of just the VMGuestState blob. Note: It can be set for only + Confidential VMs. Known values are: "DiskWithVMGuestState" and "VMGuestStateOnly". + :vartype security_encryption_type: str or + ~azure.mgmt.servicefabricmanagedclusters.models.SecurityEncryptionType + :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the nodeType. Can + only be used with TrustedLaunch and ConfidentialVM SecurityType. + :vartype secure_boot_enabled: bool + :ivar enable_node_public_ip: Specifies whether each node is allocated its own public IPv4 + address. This is only supported on secondary node types with custom Load Balancers. + :vartype enable_node_public_ip: bool + :ivar enable_node_public_i_pv6: Specifies whether each node is allocated its own public IPv6 + address. This is only supported on secondary node types with custom Load Balancers. + :vartype enable_node_public_i_pv6: bool + :ivar vm_shared_gallery_image_id: Indicates the resource id of the vm shared galleries image. + This parameter is used for custom vm image. + :vartype vm_shared_gallery_image_id: str + :ivar nat_gateway_id: Specifies the resource id of a NAT Gateway to attach to the subnet of + this node type. Node type must use custom load balancer. + :vartype nat_gateway_id: str + :ivar nat_configurations: Specifies the NAT configuration on default public Load Balancer for + the node type. This is only supported for node types use the default public Load Balancer. + :vartype nat_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeNatConfig] + :ivar vm_image_plan: Specifies information about the marketplace image used to create the + virtual machine. This element is only used for marketplace images. Before you can use a + marketplace image from an API, you must enable the image for programmatic use. In the Azure + portal, find the marketplace image that you want to use and then click Want to deploy + programmatically, Get Started ->. Enter any required information and then click Save. + :vartype vm_image_plan: ~azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan + :ivar service_artifact_reference_id: Specifies the service artifact reference id used to set + same image version for all virtual machines in the scale set when using 'latest' image version. + :vartype service_artifact_reference_id: str + :ivar dscp_configuration_id: Specifies the resource id of the DSCP configuration to apply to + the node type network interface. + :vartype dscp_configuration_id: str + :ivar additional_network_interface_configurations: Specifies the settings for any additional + secondary network interfaces to attach to the node type. + :vartype additional_network_interface_configurations: + list[~azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration] + :ivar computer_name_prefix: Specifies the computer name prefix. Limited to 9 characters. If + specified, allows for a longer name to be specified for the node type name. + :vartype computer_name_prefix: str + :ivar vm_applications: Specifies the gallery applications that should be made available to the + underlying VMSS. + :vartype vm_applications: list[~azure.mgmt.servicefabricmanagedclusters.models.VmApplication] + :ivar zone_balance: Setting this to true allows stateless node types to scale out without equal + distribution across zones. + :vartype zone_balance: bool """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } + is_primary: bool = rest_field(name="isPrimary", visibility=["read", "create", "update", "delete", "query"]) + """Indicates the Service Fabric system services for the cluster will run on this node type. This + setting cannot be changed once the node type is created. Required.""" + vm_instance_count: int = rest_field( + name="vmInstanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """The number of nodes in the node type. **Values:** -1 - Use when auto scale rules are configured + or sku.capacity is defined 0 - Not supported >0 - Use for manual scale. Required.""" + data_disk_size_gb: Optional[int] = rest_field( + name="dataDiskSizeGB", visibility=["read", "create", "update", "delete", "query"] + ) + """Disk size for the managed disk attached to the vms on the node type in GBs.""" + data_disk_type: Optional[Union[str, "_models.DiskType"]] = rest_field( + name="dataDiskType", visibility=["read", "create", "update", "delete", "query"] + ) + """Managed data disk type. Specifies the storage account type for the managed disk. Known values + are: \"Standard_LRS\", \"StandardSSD_LRS\", \"Premium_LRS\", \"PremiumV2_LRS\", + \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + data_disk_letter: Optional[str] = rest_field( + name="dataDiskLetter", visibility=["read", "create", "update", "delete", "query"] + ) + """Managed data disk letter. It can not use the reserved letter C or D and it can not change after + created.""" + placement_properties: Optional[Dict[str, str]] = rest_field( + name="placementProperties", visibility=["read", "create", "update", "delete", "query"] + ) + """The placement tags applied to nodes in the node type, which can be used to indicate where + certain services (workload) should run.""" + capacities: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The capacity tags applied to the nodes in the node type, the cluster resource manager uses + these tags to understand how much resource a node has.""" + application_ports: Optional["_models.EndpointRangeDescription"] = rest_field( + name="applicationPorts", visibility=["read", "create", "update", "delete", "query"] + ) + """The range of ports from which cluster assigned port to Service Fabric applications.""" + ephemeral_ports: Optional["_models.EndpointRangeDescription"] = rest_field( + name="ephemeralPorts", visibility=["read", "create", "update", "delete", "query"] + ) + """The range of ephemeral ports that nodes in this node type should be configured with.""" + vm_size: Optional[str] = rest_field(name="vmSize", visibility=["read", "create", "update", "delete", "query"]) + """The size of virtual machines in the pool. All virtual machines in a pool are the same size. For + example, Standard_D3.""" + vm_image_publisher: Optional[str] = rest_field( + name="vmImagePublisher", visibility=["read", "create", "update", "delete", "query"] + ) + """The publisher of the Azure Virtual Machines Marketplace image. For example, Canonical or + MicrosoftWindowsServer.""" + vm_image_offer: Optional[str] = rest_field( + name="vmImageOffer", visibility=["read", "create", "update", "delete", "query"] + ) + """The offer type of the Azure Virtual Machines Marketplace image. For example, UbuntuServer or + WindowsServer.""" + vm_image_sku: Optional[str] = rest_field( + name="vmImageSku", visibility=["read", "create", "update", "delete", "query"] + ) + """The SKU of the Azure Virtual Machines Marketplace image. For example, 14.04.0-LTS or + 2012-R2-Datacenter.""" + vm_image_version: Optional[str] = rest_field( + name="vmImageVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """The version of the Azure Virtual Machines Marketplace image. A value of 'latest' can be + specified to select the latest version of an image. If omitted, the default is 'latest'.""" + vm_secrets: Optional[List["_models.VaultSecretGroup"]] = rest_field( + name="vmSecrets", visibility=["read", "create", "update", "delete", "query"] + ) + """The secrets to install in the virtual machines.""" + vm_extensions: Optional[List["_models.VMSSExtension"]] = rest_field( + name="vmExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Set of extensions that should be installed onto the virtual machines.""" + vm_managed_identity: Optional["_models.VmManagedIdentity"] = rest_field( + name="vmManagedIdentity", visibility=["read", "create", "update", "delete", "query"] + ) + """Identities to assign to the virtual machine scale set under the node type.""" + is_stateless: Optional[bool] = rest_field( + name="isStateless", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if the node type can only host Stateless workloads.""" + multiple_placement_groups: Optional[bool] = rest_field( + name="multiplePlacementGroups", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates if scale set associated with the node type can be composed of multiple placement + groups.""" + frontend_configurations: Optional[List["_models.FrontendConfiguration"]] = rest_field( + name="frontendConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the node type uses its own frontend configurations instead of the default one for the + cluster. This setting can only be specified for non-primary node types and can not be added or + removed after the node type is created.""" + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = rest_field( + name="networkSecurityRules", visibility=["read", "create", "update", "delete", "query"] + ) + """The Network Security Rules for this node type. This setting can only be specified for node + types that are configured with frontend configurations.""" + additional_data_disks: Optional[List["_models.VmssDataDisk"]] = rest_field( + name="additionalDataDisks", visibility=["read", "create", "update", "delete", "query"] + ) + """Additional managed data disks.""" + enable_encryption_at_host: Optional[bool] = rest_field( + name="enableEncryptionAtHost", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable or disable the Host Encryption for the virtual machines on the node type. This will + enable the encryption for all the disks including Resource/Temp disk at host itself. Default: + The Encryption at host will be disabled unless this property is set to true for the resource.""" + provisioning_state: Optional[Union[str, "_models.ManagedResourceProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the node type resource. Known values are: \"None\", \"Creating\", + \"Created\", \"Updating\", \"Succeeded\", \"Failed\", \"Canceled\", \"Deleting\", \"Deleted\", + and \"Other\".""" + enable_accelerated_networking: Optional[bool] = rest_field( + name="enableAcceleratedNetworking", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the network interface is accelerated networking-enabled.""" + use_default_public_load_balancer: Optional[bool] = rest_field( + name="useDefaultPublicLoadBalancer", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the use public load balancer. If not specified and the node type doesn't have + its own frontend configuration, it will be attached to the default load balancer. If the node + type uses its own Load balancer and useDefaultPublicLoadBalancer is true, then the frontend has + to be an Internal Load Balancer. If the node type uses its own Load balancer and + useDefaultPublicLoadBalancer is false or not set, then the custom load balancer must include a + public load balancer to provide outbound connectivity.""" + use_temp_data_disk: Optional[bool] = rest_field( + name="useTempDataDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether to use the temporary disk for the service fabric data root, in which case no + managed data disk will be attached and the temporary disk will be used. It is only allowed for + stateless node types.""" + enable_over_provisioning: Optional[bool] = rest_field( + name="enableOverProvisioning", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether the node type should be overprovisioned. It is only allowed for stateless + node types.""" + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the availability zones where the node type would span across. If the cluster is not + spanning across availability zones, initiates az migration for the cluster.""" + is_spot_vm: Optional[bool] = rest_field(name="isSpotVM", visibility=["read", "create", "update", "delete", "query"]) + """Indicates whether the node type will be Spot Virtual Machines. Azure will allocate the VMs if + there is capacity available and the VMs can be evicted at any time.""" + host_group_id: Optional[str] = rest_field( + name="hostGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the full host group resource Id. This property is used for deploying on azure + dedicated hosts.""" + use_ephemeral_os_disk: Optional[bool] = rest_field( + name="useEphemeralOSDisk", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether to use ephemeral os disk. The sku selected on the vmSize property needs to + support this feature.""" + spot_restore_timeout: Optional[str] = rest_field( + name="spotRestoreTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the time duration after which the platform will not try to restore the VMSS SPOT + instances specified as ISO 8601.""" + eviction_policy: Optional[Union[str, "_models.EvictionPolicyType"]] = rest_field( + name="evictionPolicy", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the eviction policy for virtual machines in a SPOT node type. Default is Delete. + Known values are: \"Delete\" and \"Deallocate\".""" + vm_image_resource_id: Optional[str] = rest_field( + name="vmImageResourceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the resource id of the vm image. This parameter is used for custom vm image.""" + subnet_id: Optional[str] = rest_field(name="subnetId", visibility=["read", "create", "update", "delete", "query"]) + """Indicates the resource id of the subnet for the node type.""" + vm_setup_actions: Optional[List[Union[str, "_models.VmSetupAction"]]] = rest_field( + name="vmSetupActions", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the actions to be performed on the vms before bootstrapping the service fabric + runtime.""" + security_type: Optional[Union[str, "_models.SecurityType"]] = rest_field( + name="securityType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the security type of the nodeType. Supported values include Standard, TrustedLaunch + and ConfidentialVM. Known values are: \"TrustedLaunch\", \"Standard\", and \"ConfidentialVM\".""" + security_encryption_type: Optional[Union[str, "_models.SecurityEncryptionType"]] = rest_field( + name="securityEncryptionType", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the EncryptionType of the managed disk. It is set to DiskWithVMGuestState for + encryption of the managed disk along with VMGuestState blob and VMGuestStateOnly for encryption + of just the VMGuestState blob. Note: It can be set for only Confidential VMs. Known values are: + \"DiskWithVMGuestState\" and \"VMGuestStateOnly\".""" + secure_boot_enabled: Optional[bool] = rest_field( + name="secureBootEnabled", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether secure boot should be enabled on the nodeType. Can only be used with + TrustedLaunch and ConfidentialVM SecurityType.""" + enable_node_public_ip: Optional[bool] = rest_field( + name="enableNodePublicIP", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether each node is allocated its own public IPv4 address. This is only supported on + secondary node types with custom Load Balancers.""" + enable_node_public_i_pv6: Optional[bool] = rest_field( + name="enableNodePublicIPv6", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies whether each node is allocated its own public IPv6 address. This is only supported on + secondary node types with custom Load Balancers.""" + vm_shared_gallery_image_id: Optional[str] = rest_field( + name="vmSharedGalleryImageId", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the resource id of the vm shared galleries image. This parameter is used for custom + vm image.""" + nat_gateway_id: Optional[str] = rest_field( + name="natGatewayId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the resource id of a NAT Gateway to attach to the subnet of this node type. Node type + must use custom load balancer.""" + nat_configurations: Optional[List["_models.NodeTypeNatConfig"]] = rest_field( + name="natConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the NAT configuration on default public Load Balancer for the node type. This is only + supported for node types use the default public Load Balancer.""" + vm_image_plan: Optional["_models.VmImagePlan"] = rest_field( + name="vmImagePlan", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies information about the marketplace image used to create the virtual machine. This + element is only used for marketplace images. Before you can use a marketplace image from an + API, you must enable the image for programmatic use. In the Azure portal, find the marketplace + image that you want to use and then click Want to deploy programmatically, Get Started ->. + Enter any required information and then click Save.""" + service_artifact_reference_id: Optional[str] = rest_field( + name="serviceArtifactReferenceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the service artifact reference id used to set same image version for all virtual + machines in the scale set when using 'latest' image version.""" + dscp_configuration_id: Optional[str] = rest_field( + name="dscpConfigurationId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the resource id of the DSCP configuration to apply to the node type network + interface.""" + additional_network_interface_configurations: Optional[List["_models.AdditionalNetworkInterfaceConfiguration"]] = ( + rest_field( + name="additionalNetworkInterfaceConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + ) + """Specifies the settings for any additional secondary network interfaces to attach to the node + type.""" + computer_name_prefix: Optional[str] = rest_field( + name="computerNamePrefix", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the computer name prefix. Limited to 9 characters. If specified, allows for a longer + name to be specified for the node type name.""" + vm_applications: Optional[List["_models.VmApplication"]] = rest_field( + name="vmApplications", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the gallery applications that should be made available to the underlying VMSS.""" + zone_balance: Optional[bool] = rest_field( + name="zoneBalance", visibility=["read", "create", "update", "delete", "query"] + ) + """Setting this to true allows stateless node types to scale out without equal distribution across + zones.""" + + @overload + def __init__( # pylint: disable=too-many-locals + self, + *, + is_primary: bool, + vm_instance_count: int, + data_disk_size_gb: Optional[int] = None, + data_disk_type: Optional[Union[str, "_models.DiskType"]] = None, + data_disk_letter: Optional[str] = None, + placement_properties: Optional[Dict[str, str]] = None, + capacities: Optional[Dict[str, str]] = None, + application_ports: Optional["_models.EndpointRangeDescription"] = None, + ephemeral_ports: Optional["_models.EndpointRangeDescription"] = None, + vm_size: Optional[str] = None, + vm_image_publisher: Optional[str] = None, + vm_image_offer: Optional[str] = None, + vm_image_sku: Optional[str] = None, + vm_image_version: Optional[str] = None, + vm_secrets: Optional[List["_models.VaultSecretGroup"]] = None, + vm_extensions: Optional[List["_models.VMSSExtension"]] = None, + vm_managed_identity: Optional["_models.VmManagedIdentity"] = None, + is_stateless: Optional[bool] = None, + multiple_placement_groups: Optional[bool] = None, + frontend_configurations: Optional[List["_models.FrontendConfiguration"]] = None, + network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, + additional_data_disks: Optional[List["_models.VmssDataDisk"]] = None, + enable_encryption_at_host: Optional[bool] = None, + enable_accelerated_networking: Optional[bool] = None, + use_default_public_load_balancer: Optional[bool] = None, + use_temp_data_disk: Optional[bool] = None, + enable_over_provisioning: Optional[bool] = None, + zones: Optional[List[str]] = None, + is_spot_vm: Optional[bool] = None, + host_group_id: Optional[str] = None, + use_ephemeral_os_disk: Optional[bool] = None, + spot_restore_timeout: Optional[str] = None, + eviction_policy: Optional[Union[str, "_models.EvictionPolicyType"]] = None, + vm_image_resource_id: Optional[str] = None, + subnet_id: Optional[str] = None, + vm_setup_actions: Optional[List[Union[str, "_models.VmSetupAction"]]] = None, + security_type: Optional[Union[str, "_models.SecurityType"]] = None, + security_encryption_type: Optional[Union[str, "_models.SecurityEncryptionType"]] = None, + secure_boot_enabled: Optional[bool] = None, + enable_node_public_ip: Optional[bool] = None, + enable_node_public_i_pv6: Optional[bool] = None, + vm_shared_gallery_image_id: Optional[str] = None, + nat_gateway_id: Optional[str] = None, + nat_configurations: Optional[List["_models.NodeTypeNatConfig"]] = None, + vm_image_plan: Optional["_models.VmImagePlan"] = None, + service_artifact_reference_id: Optional[str] = None, + dscp_configuration_id: Optional[str] = None, + additional_network_interface_configurations: Optional[ + List["_models.AdditionalNetworkInterfaceConfiguration"] + ] = None, + computer_name_prefix: Optional[str] = None, + vm_applications: Optional[List["_models.VmApplication"]] = None, + zone_balance: 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 NodeTypeSku(_Model): + """Describes a node type sku. + + :ivar name: The sku name. Name is internally generated and is used in auto-scale scenarios. + Property does not allow to be changed to other values than generated. To avoid deployment + errors please omit the property. + :vartype name: str + :ivar tier: Specifies the tier of the node type. Possible Values: **Standard**. + :vartype tier: str + :ivar capacity: The number of nodes in the node type. If present in request it will override + properties.vmInstanceCount. Required. + :vartype capacity: int + """ - def __init__(self, **kwargs): - super(NodeTypeUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", None) + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The sku name. Name is internally generated and is used in auto-scale scenarios. Property does + not allow to be changed to other values than generated. To avoid deployment errors please omit + the property.""" + tier: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the tier of the node type. Possible Values: **Standard**.""" + capacity: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of nodes in the node type. If present in request it will override + properties.vmInstanceCount. Required.""" + + @overload + def __init__( + self, + *, + capacity: int, + name: Optional[str] = None, + tier: 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 NodeTypeSkuCapacity(_Model): + """Provides information about how node type can be scaled. + + :ivar minimum: Lowest permitted node count in a node type. + :vartype minimum: int + :ivar maximum: Highest permitted node count in a node type. + :vartype maximum: int + :ivar default: Default node count in a node type. + :vartype default: int + :ivar scale_type: Node type capacity scale type. Known values are: "None", "Manual", and + "Automatic". + :vartype scale_type: str or + ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuScaleType + """ + minimum: Optional[int] = rest_field(visibility=["read"]) + """Lowest permitted node count in a node type.""" + maximum: Optional[int] = rest_field(visibility=["read"]) + """Highest permitted node count in a node type.""" + default: Optional[int] = rest_field(visibility=["read"]) + """Default node count in a node type.""" + scale_type: Optional[Union[str, "_models.NodeTypeSkuScaleType"]] = rest_field(name="scaleType", visibility=["read"]) + """Node type capacity scale type. Known values are: \"None\", \"Manual\", and \"Automatic\".""" -class OperationListResult(msrest.serialization.Model): - """Describes the result of the request to list Service Fabric resource provider operations. - Variables are only populated by the server, and will be ignored when sending a request. +class NodeTypeSupportedSku(_Model): + """Describes a node type supported sku. - :param value: List of operations supported by the Service Fabric resource provider. - :type value: list[~service_fabric_managed_clusters_management_client.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str + :ivar name: The sku name. + :vartype name: str + :ivar tier: Specifies the tier of the node type. Possible Values: **Standard**. + :vartype tier: str """ - _validation = { - "next_link": {"readonly": True}, - } + name: Optional[str] = rest_field(visibility=["read"]) + """The sku name.""" + tier: Optional[str] = rest_field(visibility=["read"]) + """Specifies the tier of the node type. Possible Values: **Standard**.""" - _attribute_map = { - "value": {"key": "value", "type": "[OperationResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - def __init__(self, **kwargs): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = None +class NodeTypeUpdateParameters(_Model): + """Node type update request. + :ivar tags: Node type update parameters. + :vartype tags: dict[str, str] + :ivar sku: The node type sku. + :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku + """ -class OperationResult(msrest.serialization.Model): - """Available operation list result. + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Node type update parameters.""" + sku: Optional["_models.NodeTypeSku"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The node type sku.""" - :param name: The name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: - ~service_fabric_managed_clusters_management_client.models.AvailableOperationDisplay - :param origin: Origin result. - :type origin: str - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "AvailableOperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - super(OperationResult, self).__init__(**kwargs) - self.name = kwargs.get("name", None) - self.is_data_action = kwargs.get("is_data_action", None) - self.display = kwargs.get("display", None) - self.origin = kwargs.get("origin", None) - self.next_link = kwargs.get("next_link", None) - - -class PartitionInstanceCountScaleMechanism(ScalingMechanism): - """Represents a scaling mechanism for adding or removing instances of stateless service partition. + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + sku: Optional["_models.NodeTypeSku"] = None, + ) -> None: ... - All required parameters must be populated in order to send to Azure. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", - "AddRemoveIncrementalNamedPartition". - :type kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind - :param min_instance_count: Required. Minimum number of instances of the partition. - :type min_instance_count: int - :param max_instance_count: Required. Maximum number of instances of the partition. - :type max_instance_count: int - :param scale_increment: Required. The number of instances to add or remove during a scaling - operation. - :type scale_increment: int - """ - - _validation = { - "kind": {"required": True}, - "min_instance_count": {"required": True}, - "max_instance_count": {"required": True}, - "scale_increment": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "min_instance_count": {"key": "minInstanceCount", "type": "int"}, - "max_instance_count": {"key": "maxInstanceCount", "type": "int"}, - "scale_increment": {"key": "scaleIncrement", "type": "int"}, - } - - def __init__(self, **kwargs): - super(PartitionInstanceCountScaleMechanism, self).__init__(**kwargs) - self.kind = "ScalePartitionInstanceCount" # type: str - self.min_instance_count = kwargs["min_instance_count"] - self.max_instance_count = kwargs["max_instance_count"] - self.scale_increment = kwargs["scale_increment"] - - -class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): - """The policy used for monitoring the application upgrade. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - All required parameters must be populated in order to send to Azure. - - :param failure_action: Required. The compensating action to perform when a Monitored upgrade - encounters monitoring policy or health policy violations. Invalid indicates the failure action - is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual - indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Possible values - include: "Rollback", "Manual". - :type failure_action: str or - ~service_fabric_managed_clusters_management_client.models.FailureAction - :param health_check_wait_duration: Required. The amount of time to wait after completing an - upgrade domain before applying health policies. It is interpreted as a string representing an - ISO 8601 duration with following format "hh:mm:ss.fff". - :type health_check_wait_duration: str - :param health_check_stable_duration: Required. The amount of time that the application or - cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is - interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :type health_check_stable_duration: str - :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when - the application or cluster is unhealthy before FailureAction is executed. It is interpreted as - a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :type health_check_retry_timeout: str - :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before - FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :type upgrade_timeout: str - :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete - before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :type upgrade_domain_timeout: str - """ - - _validation = { - "failure_action": {"required": True}, - "health_check_wait_duration": {"required": True}, - "health_check_stable_duration": {"required": True}, - "health_check_retry_timeout": {"required": True}, - "upgrade_timeout": {"required": True}, - "upgrade_domain_timeout": {"required": True}, - } - - _attribute_map = { - "failure_action": {"key": "failureAction", "type": "str"}, - "health_check_wait_duration": {"key": "healthCheckWaitDuration", "type": "str"}, - "health_check_stable_duration": {"key": "healthCheckStableDuration", "type": "str"}, - "health_check_retry_timeout": {"key": "healthCheckRetryTimeout", "type": "str"}, - "upgrade_timeout": {"key": "upgradeTimeout", "type": "str"}, - "upgrade_domain_timeout": {"key": "upgradeDomainTimeout", "type": "str"}, - } - - def __init__(self, **kwargs): - super(RollingUpgradeMonitoringPolicy, self).__init__(**kwargs) - self.failure_action = kwargs["failure_action"] - self.health_check_wait_duration = kwargs["health_check_wait_duration"] - self.health_check_stable_duration = kwargs["health_check_stable_duration"] - self.health_check_retry_timeout = kwargs["health_check_retry_timeout"] - self.upgrade_timeout = kwargs["upgrade_timeout"] - self.upgrade_domain_timeout = kwargs["upgrade_domain_timeout"] - - -class ScalingPolicy(msrest.serialization.Model): - """Specifies a metric to load balance a service during runtime. - All required parameters must be populated in order to send to Azure. +class OperationResult(_Model): + """Available operation list result. - :param scaling_mechanism: Required. Specifies the mechanism associated with this scaling - policy. - :type scaling_mechanism: - ~service_fabric_managed_clusters_management_client.models.ScalingMechanism - :param scaling_trigger: Required. Specifies the trigger associated with this scaling policy. - :type scaling_trigger: ~service_fabric_managed_clusters_management_client.models.ScalingTrigger + :ivar name: The name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.servicefabricmanagedclusters.models.AvailableOperationDisplay + :ivar origin: Origin result. + :vartype origin: str + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ - _validation = { - "scaling_mechanism": {"required": True}, - "scaling_trigger": {"required": True}, - } - - _attribute_map = { - "scaling_mechanism": {"key": "scalingMechanism", "type": "ScalingMechanism"}, - "scaling_trigger": {"key": "scalingTrigger", "type": "ScalingTrigger"}, - } - - def __init__(self, **kwargs): - super(ScalingPolicy, self).__init__(**kwargs) - self.scaling_mechanism = kwargs["scaling_mechanism"] - self.scaling_trigger = kwargs["scaling_trigger"] - - -class ServiceCorrelation(msrest.serialization.Model): - """Creates a particular correlation between services. - - All required parameters must be populated in order to send to Azure. + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the operation.""" + is_data_action: Optional[bool] = rest_field( + name="isDataAction", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the operation is a data action.""" + display: Optional["_models.AvailableOperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The object that represents the operation.""" + origin: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Origin result.""" + next_link: Optional[str] = rest_field(name="nextLink", visibility=["read", "create", "update", "delete", "query"]) + """The URL to use for getting the next set of results.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["_models.AvailableOperationDisplay"] = None, + origin: Optional[str] = None, + next_link: 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 PartitionInstanceCountScaleMechanism(ScalingMechanism, discriminator="ScalePartitionInstanceCount"): + """Represents a scaling mechanism for adding or removing instances of stateless service partition. - :param scheme: Required. The ServiceCorrelationScheme which describes the relationship between - this service and the service specified via ServiceName. Possible values include: - "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or - ~service_fabric_managed_clusters_management_client.models.ServiceCorrelationScheme - :param service_name: Required. The Arm Resource ID of the service that the correlation - relationship is established with. - :type service_name: str + :ivar min_instance_count: Minimum number of instances of the partition. Required. + :vartype min_instance_count: int + :ivar max_instance_count: Maximum number of instances of the partition. Required. + :vartype max_instance_count: int + :ivar scale_increment: The number of instances to add or remove during a scaling operation. + Required. + :vartype scale_increment: int + :ivar kind: Specifies the mechanism associated with this scaling policy. Required. Represents a + scaling mechanism for adding or removing instances of stateless service partition. The value is + 0. + :vartype kind: str or + ~azure.mgmt.servicefabricmanagedclusters.models.SCALE_PARTITION_INSTANCE_COUNT """ - _validation = { - "scheme": {"required": True}, - "service_name": {"required": True}, - } - - _attribute_map = { - "scheme": {"key": "scheme", "type": "str"}, - "service_name": {"key": "serviceName", "type": "str"}, - } + min_instance_count: int = rest_field( + name="minInstanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Minimum number of instances of the partition. Required.""" + max_instance_count: int = rest_field( + name="maxInstanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Maximum number of instances of the partition. Required.""" + scale_increment: int = rest_field(name="scaleIncrement", visibility=["read", "create", "update", "delete", "query"]) + """The number of instances to add or remove during a scaling operation. Required.""" + kind: Literal[ServiceScalingMechanismKind.SCALE_PARTITION_INSTANCE_COUNT] = rest_discriminator(name="kind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies the mechanism associated with this scaling policy. Required. Represents a scaling + mechanism for adding or removing instances of stateless service partition. The value is 0.""" + + @overload + def __init__( + self, + *, + min_instance_count: int, + max_instance_count: int, + scale_increment: int, + ) -> 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, kind=ServiceScalingMechanismKind.SCALE_PARTITION_INSTANCE_COUNT, **kwargs) + + +class ResourceAzStatus(_Model): + """Describes Az Resiliency status of Base resources. + + :ivar resource_name: VM Size properties. + :vartype resource_name: str + :ivar resource_type: VM Size id. + :vartype resource_type: str + :ivar is_zone_resilient: VM Size name. + :vartype is_zone_resilient: bool + :ivar details: Zone resiliency status details for the resource. + :vartype details: str + """ - def __init__(self, **kwargs): - super(ServiceCorrelation, self).__init__(**kwargs) - self.scheme = kwargs["scheme"] - self.service_name = kwargs["service_name"] + resource_name: Optional[str] = rest_field(name="resourceName", visibility=["read"]) + """VM Size properties.""" + resource_type: Optional[str] = rest_field(name="resourceType", visibility=["read"]) + """VM Size id.""" + is_zone_resilient: Optional[bool] = rest_field(name="isZoneResilient", visibility=["read"]) + """VM Size name.""" + details: Optional[str] = rest_field(visibility=["read"]) + """Zone resiliency status details for the resource.""" -class ServiceLoadMetric(msrest.serialization.Model): - """Specifies a metric to load balance a service during runtime. +class RollingUpgradeMonitoringPolicy(_Model): + """The policy used for monitoring the application upgrade. - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the metric. If the service chooses to report load during - runtime, the load metric name should match the name that is specified in Name exactly. Note - that metric names are case sensitive. - :type name: str - :param weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". - :type weight: str or - ~service_fabric_managed_clusters_management_client.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a - number, that this service creates for this metric when it is a Primary replica. - :type primary_default_load: int - :param secondary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Secondary replica. - :type secondary_default_load: int - :param default_load: Used only for Stateless services. The default amount of load, as a number, - that this service creates for this metric. - :type default_load: int + :ivar failure_action: The compensating action to perform when a Monitored upgrade encounters + monitoring policy or health policy violations. Invalid indicates the failure action is invalid. + Rollback specifies that the upgrade will start rolling back automatically. Manual indicates + that the upgrade will switch to UnmonitoredManual upgrade mode. Required. Known values are: + "Rollback" and "Manual". + :vartype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction + :ivar health_check_wait_duration: The amount of time to wait after completing an upgrade domain + before applying health policies. It is interpreted as a string representing an ISO 8601 + duration with following format "hh:mm:ss.fff". Required. + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. It is interpreted as a + string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before FailureAction is executed. It is interpreted as a + string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before + FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. + :vartype upgrade_domain_timeout: str """ - _validation = { - "name": {"required": True}, - } + failure_action: Union[str, "_models.FailureAction"] = rest_field( + name="failureAction", visibility=["read", "create", "update", "delete", "query"] + ) + """The compensating action to perform when a Monitored upgrade encounters monitoring policy or + health policy violations. Invalid indicates the failure action is invalid. Rollback specifies + that the upgrade will start rolling back automatically. Manual indicates that the upgrade will + switch to UnmonitoredManual upgrade mode. Required. Known values are: \"Rollback\" and + \"Manual\".""" + health_check_wait_duration: str = rest_field( + name="healthCheckWaitDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time to wait after completing an upgrade domain before applying health policies. + It is interpreted as a string representing an ISO 8601 duration with following format + \"hh:mm:ss.fff\". Required.""" + health_check_stable_duration: str = rest_field( + name="healthCheckStableDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time that the application or cluster must remain healthy before the upgrade + proceeds to the next upgrade domain. It is interpreted as a string representing an ISO 8601 + duration with following format \"hh:mm:ss.fff\". Required.""" + health_check_retry_timeout: str = rest_field( + name="healthCheckRetryTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time to retry health evaluation when the application or cluster is unhealthy + before FailureAction is executed. It is interpreted as a string representing an ISO 8601 + duration with following format \"hh:mm:ss.fff\". Required.""" + upgrade_timeout: str = rest_field(name="upgradeTimeout", visibility=["read", "create", "update", "delete", "query"]) + """The amount of time the overall upgrade has to complete before FailureAction is executed. Cannot + be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with + following format \"hh:mm:ss.fff\". Required.""" + upgrade_domain_timeout: str = rest_field( + name="upgradeDomainTimeout", visibility=["read", "create", "update", "delete", "query"] + ) + """The amount of time each upgrade domain has to complete before FailureAction is executed. Cannot + be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with + following format \"hh:mm:ss.fff\". Required.""" + + @overload + def __init__( + self, + *, + failure_action: Union[str, "_models.FailureAction"], + health_check_wait_duration: str, + health_check_stable_duration: str, + health_check_retry_timeout: str, + upgrade_timeout: str, + upgrade_domain_timeout: 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 RuntimeResumeApplicationUpgradeParameters(_Model): # pylint: disable=name-too-long + """Parameters for Resume Upgrade action. The upgrade domain name must be specified. + + :ivar upgrade_domain_name: The upgrade domain name. Expected to be the next upgrade domain if + the application is upgrading. + :vartype upgrade_domain_name: str + """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "weight": {"key": "weight", "type": "str"}, - "primary_default_load": {"key": "primaryDefaultLoad", "type": "int"}, - "secondary_default_load": {"key": "secondaryDefaultLoad", "type": "int"}, - "default_load": {"key": "defaultLoad", "type": "int"}, - } + upgrade_domain_name: Optional[str] = rest_field( + name="upgradeDomainName", visibility=["read", "create", "update", "delete", "query"] + ) + """The upgrade domain name. Expected to be the next upgrade domain if the application is + upgrading.""" - def __init__(self, **kwargs): - super(ServiceLoadMetric, self).__init__(**kwargs) - self.name = kwargs["name"] - self.weight = kwargs.get("weight", None) - self.primary_default_load = kwargs.get("primary_default_load", None) - self.secondary_default_load = kwargs.get("secondary_default_load", None) - self.default_load = kwargs.get("default_load", None) + @overload + def __init__( + self, + *, + upgrade_domain_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] + """ -class ServicePlacementPolicy(msrest.serialization.Model): - """Describes the policy to be used for placement of a Service Fabric service. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ServicePlacementInvalidDomainPolicy, ServicePlacementNonPartiallyPlaceServicePolicy, ServicePlacementPreferPrimaryDomainPolicy, ServicePlacementRequiredDomainPolicy, ServicePlacementRequireDomainDistributionPolicy. - All required parameters must be populated in order to send to Azure. +class ScalingPolicy(_Model): + """Specifies a metric to load balance a service during runtime. - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :ivar scaling_mechanism: Specifies the mechanism associated with this scaling policy. Required. + :vartype scaling_mechanism: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingMechanism + :ivar scaling_trigger: Specifies the trigger associated with this scaling policy. Required. + :vartype scaling_trigger: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingTrigger """ - _validation = { - "type": {"required": True}, - } + scaling_mechanism: "_models.ScalingMechanism" = rest_field( + name="scalingMechanism", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the mechanism associated with this scaling policy. Required.""" + scaling_trigger: "_models.ScalingTrigger" = rest_field( + name="scalingTrigger", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the trigger associated with this scaling policy. Required.""" + + @overload + def __init__( + self, + *, + scaling_mechanism: "_models.ScalingMechanism", + scaling_trigger: "_models.ScalingTrigger", + ) -> 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 ServiceCorrelation(_Model): + """Creates a particular correlation between services. - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } + :ivar scheme: The ServiceCorrelationScheme which describes the relationship between this + service and the service specified via ServiceName. Required. Known values are: + "AlignedAffinity" and "NonAlignedAffinity". + :vartype scheme: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme + :ivar service_name: The Arm Resource ID of the service that the correlation relationship is + established with. Required. + :vartype service_name: str + """ - _subtype_map = { - "type": { - "InvalidDomain": "ServicePlacementInvalidDomainPolicy", - "NonPartiallyPlaceService": "ServicePlacementNonPartiallyPlaceServicePolicy", - "PreferredPrimaryDomain": "ServicePlacementPreferPrimaryDomainPolicy", - "RequiredDomain": "ServicePlacementRequiredDomainPolicy", - "RequiredDomainDistribution": "ServicePlacementRequireDomainDistributionPolicy", - } - } + scheme: Union[str, "_models.ServiceCorrelationScheme"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The ServiceCorrelationScheme which describes the relationship between this service and the + service specified via ServiceName. Required. Known values are: \"AlignedAffinity\" and + \"NonAlignedAffinity\".""" + service_name: str = rest_field(name="serviceName", visibility=["read", "create", "update", "delete", "query"]) + """The Arm Resource ID of the service that the correlation relationship is established with. + Required.""" + + @overload + def __init__( + self, + *, + scheme: Union[str, "_models.ServiceCorrelationScheme"], + service_name: 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 ServiceEndpoint(_Model): + """The service endpoint properties. + + :ivar service: The type of the endpoint service. Required. + :vartype service: str + :ivar locations: A list of locations. + :vartype locations: list[str] + """ - def __init__(self, **kwargs): - super(ServicePlacementPolicy, self).__init__(**kwargs) - self.type = None # type: Optional[str] + service: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of the endpoint service. Required.""" + locations: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """A list of locations.""" + @overload + def __init__( + self, + *, + service: str, + locations: Optional[List[str]] = None, + ) -> None: ... -class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): - """Describes the policy to be used for placement of a Service Fabric service where a particular fault or upgrade domain should not be used for placement of the instances or replicas of that service. + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ - All required parameters must be populated in order to send to Azure. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should not be used for placement. - :type domain_name: str - """ - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } +class ServiceLoadMetric(_Model): + """Specifies a metric to load balance a service during runtime. - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } + :ivar name: The name of the metric. If the service chooses to report load during runtime, the + load metric name should match the name that is specified in Name exactly. Note that metric + names are case sensitive. Required. + :vartype name: str + :ivar weight: The service load metric relative weight, compared to other metrics configured for + this service, as a number. Known values are: "Zero", "Low", "Medium", and "High". + :vartype weight: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight + :ivar primary_default_load: Used only for Stateful services. The default amount of load, as a + number, that this service creates for this metric when it is a Primary replica. + :vartype primary_default_load: int + :ivar secondary_default_load: Used only for Stateful services. The default amount of load, as a + number, that this service creates for this metric when it is a Secondary replica. + :vartype secondary_default_load: int + :ivar default_load: Used only for Stateless services. The default amount of load, as a number, + that this service creates for this metric. + :vartype default_load: int + """ - def __init__(self, **kwargs): - super(ServicePlacementInvalidDomainPolicy, self).__init__(**kwargs) - self.type = "InvalidDomain" # type: str - self.domain_name = kwargs["domain_name"] + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the metric. If the service chooses to report load during runtime, the load metric + name should match the name that is specified in Name exactly. Note that metric names are case + sensitive. Required.""" + weight: Optional[Union[str, "_models.ServiceLoadMetricWeight"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The service load metric relative weight, compared to other metrics configured for this service, + as a number. Known values are: \"Zero\", \"Low\", \"Medium\", and \"High\".""" + primary_default_load: Optional[int] = rest_field( + name="primaryDefaultLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """Used only for Stateful services. The default amount of load, as a number, that this service + creates for this metric when it is a Primary replica.""" + secondary_default_load: Optional[int] = rest_field( + name="secondaryDefaultLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """Used only for Stateful services. The default amount of load, as a number, that this service + creates for this metric when it is a Secondary replica.""" + default_load: Optional[int] = rest_field( + name="defaultLoad", visibility=["read", "create", "update", "delete", "query"] + ) + """Used only for Stateless services. The default amount of load, as a number, that this service + creates for this metric.""" + + @overload + def __init__( + self, + *, + name: str, + weight: Optional[Union[str, "_models.ServiceLoadMetricWeight"]] = None, + primary_default_load: Optional[int] = None, + secondary_default_load: Optional[int] = None, + default_load: 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 ServicePlacementPolicy(_Model): + """Describes the policy to be used for placement of a Service Fabric service. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + ServicePlacementInvalidDomainPolicy, ServicePlacementNonPartiallyPlaceServicePolicy, + ServicePlacementPreferPrimaryDomainPolicy, ServicePlacementRequiredDomainPolicy, + ServicePlacementRequireDomainDistributionPolicy -class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): - """ServicePlacementNonPartiallyPlaceServicePolicy. + :ivar type: Required. Known values are: "InvalidDomain", "RequiredDomain", + "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". + :vartype type: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType + """ - All required parameters must be populated in order to send to Azure. + __mapping__: Dict[str, _Model] = {} + type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) + """Required. Known values are: \"InvalidDomain\", \"RequiredDomain\", \"PreferredPrimaryDomain\", + \"RequiredDomainDistribution\", and \"NonPartiallyPlaceService\".""" + + @overload + def __init__( + self, + *, + type: 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 ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy, discriminator="InvalidDomain"): + """Describes the policy to be used for placement of a Service Fabric service where a particular + fault or upgrade domain should not be used for placement of the instances or replicas of that + service. + + :ivar domain_name: The name of the domain that should not be used for placement. Required. + :vartype domain_name: str + :ivar type: The type of placement policy for a service fabric service. Following are the + possible values. Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementInvalidDomainPolicyDescription, which indicates that a particular fault or + upgrade domain cannot be used for placement of this service. The value is 0. + :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.INVALID_DOMAIN + """ - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + domain_name: str = rest_field(name="domainName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the domain that should not be used for placement. Required.""" + type: Literal[ServicePlacementPolicyType.INVALID_DOMAIN] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of placement policy for a service fabric service. Following are the possible values. + Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementInvalidDomainPolicyDescription, which indicates that a particular fault or + upgrade domain cannot be used for placement of this service. The value is 0.""" + + @overload + def __init__( + self, + *, + domain_name: 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, type=ServicePlacementPolicyType.INVALID_DOMAIN, **kwargs) + + +class ServicePlacementNonPartiallyPlaceServicePolicy( + ServicePlacementPolicy, discriminator="NonPartiallyPlaceService" +): # pylint: disable=name-too-long + """The type of placement policy for a service fabric service. Following are the possible values. + + :ivar type: Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementNonPartiallyPlaceServicePolicyDescription, which indicates that if possible all + replicas of a particular partition of the service should be placed atomically. The value is 4. + :vartype type: str or + ~azure.mgmt.servicefabricmanagedclusters.models.NON_PARTIALLY_PLACE_SERVICE """ - _validation = { - "type": {"required": True}, - } + type: Literal[ServicePlacementPolicyType.NON_PARTIALLY_PLACE_SERVICE] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementNonPartiallyPlaceServicePolicyDescription, which indicates that if possible all + replicas of a particular partition of the service should be placed atomically. The value is 4.""" - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } + @overload + def __init__( + self, + ) -> None: ... - def __init__(self, **kwargs): - super(ServicePlacementNonPartiallyPlaceServicePolicy, self).__init__(**kwargs) - self.type = "NonPartiallyPlaceService" # type: str + @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, type=ServicePlacementPolicyType.NON_PARTIALLY_PLACE_SERVICE, **kwargs) -class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): + +class ServicePlacementPreferPrimaryDomainPolicy( + ServicePlacementPolicy, discriminator="PreferredPrimaryDomain" +): # pylint: disable=name-too-long """Describes the policy to be used for placement of a Service Fabric service where the service's Primary replicas should optimally be placed in a particular domain. This placement policy is usually used with fault domains in scenarios where the Service Fabric - cluster is geographically distributed in order to indicate that a service's primary replica should - be located in a particular fault domain, which in geo-distributed scenarios usually aligns with regional - or datacenter boundaries. Note that since this is an optimization it is possible that the Primary replica + cluster is geographically distributed in order to indicate that a service's primary replica + should + be located in a particular fault domain, which in geo-distributed scenarios usually aligns with + regional + or datacenter boundaries. Note that since this is an optimization it is possible that the + Primary replica may not end up located in this domain due to failures, capacity limits, or other constraints. - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this - policy. - :type domain_name: str + :ivar domain_name: The name of the domain that should used for placement as per this policy. + Required. + :vartype domain_name: str + :ivar type: The type of placement policy for a service fabric service. Following are the + possible values. Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementPreferPrimaryDomainPolicyDescription, which indicates that if possible the + Primary replica for the partitions of the service should be located in a particular domain as + an optimization. The value is 2. + :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.PREFERRED_PRIMARY_DOMAIN """ - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ServicePlacementPreferPrimaryDomainPolicy, self).__init__(**kwargs) - self.type = "PreferredPrimaryDomain" # type: str - self.domain_name = kwargs["domain_name"] - - -class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): - """Describes the policy to be used for placement of a Service Fabric service where the instances or replicas of that service must be placed in a particular domain. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this - policy. - :type domain_name: str + domain_name: str = rest_field(name="domainName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the domain that should used for placement as per this policy. Required.""" + type: Literal[ServicePlacementPolicyType.PREFERRED_PRIMARY_DOMAIN] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of placement policy for a service fabric service. Following are the possible values. + Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementPreferPrimaryDomainPolicyDescription, which indicates that if possible the + Primary replica for the partitions of the service should be located in a particular domain as + an optimization. The value is 2.""" + + @overload + def __init__( + self, + *, + domain_name: 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, type=ServicePlacementPolicyType.PREFERRED_PRIMARY_DOMAIN, **kwargs) + + +class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy, discriminator="RequiredDomain"): + """Describes the policy to be used for placement of a Service Fabric service where the instances + or replicas of that service must be placed in a particular domain. + + :ivar domain_name: The name of the domain that should used for placement as per this policy. + Required. + :vartype domain_name: str + :ivar type: The type of placement policy for a service fabric service. Following are the + possible values. Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementRequireDomainDistributionPolicyDescription indicating that the replicas of the + service must be placed in a specific domain. The value is 1. + :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.REQUIRED_DOMAIN """ - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ServicePlacementRequiredDomainPolicy, self).__init__(**kwargs) - self.type = "RequiredDomain" # type: str - self.domain_name = kwargs["domain_name"] - - -class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): + domain_name: str = rest_field(name="domainName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the domain that should used for placement as per this policy. Required.""" + type: Literal[ServicePlacementPolicyType.REQUIRED_DOMAIN] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of placement policy for a service fabric service. Following are the possible values. + Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementRequireDomainDistributionPolicyDescription indicating that the replicas of the + service must be placed in a specific domain. The value is 1.""" + + @overload + def __init__( + self, + *, + domain_name: 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, type=ServicePlacementPolicyType.REQUIRED_DOMAIN, **kwargs) + + +class ServicePlacementRequireDomainDistributionPolicy( + ServicePlacementPolicy, discriminator="RequiredDomainDistribution" +): # pylint: disable=name-too-long """Describes the policy to be used for placement of a Service Fabric service where two replicas from the same partition should never be placed in the same fault or upgrade domain. While this is not common it can expose the service to an increased risk of concurrent failures - due to unplanned outages or other cases of subsequent/concurrent failures. As an example, consider + due to unplanned outages or other cases of subsequent/concurrent failures. As an example, + consider a case where replicas are deployed across different data center, with one replica per location. - In the event that one of the datacenters goes offline, normally the replica that was placed in that - datacenter will be packed into one of the remaining datacenters. If this is not desirable then this + In the event that one of the datacenters goes offline, normally the replica that was placed in + that + datacenter will be packed into one of the remaining datacenters. If this is not desirable then + this policy should be set. - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "InvalidDomain", - "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or - ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this - policy. - :type domain_name: str + :ivar domain_name: The name of the domain that should used for placement as per this policy. + Required. + :vartype domain_name: str + :ivar type: The type of placement policy for a service fabric service. Following are the + possible values. Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementRequireDomainDistributionPolicyDescription, indicating that the system will + disallow placement of any two replicas from the same partition in the same domain at any time. + The value is 3. + :vartype type: str or + ~azure.mgmt.servicefabricmanagedclusters.models.REQUIRED_DOMAIN_DISTRIBUTION """ - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ServicePlacementRequireDomainDistributionPolicy, self).__init__(**kwargs) - self.type = "RequiredDomainDistribution" # type: str - self.domain_name = kwargs["domain_name"] + domain_name: str = rest_field(name="domainName", visibility=["read", "create", "update", "delete", "query"]) + """The name of the domain that should used for placement as per this policy. Required.""" + type: Literal[ServicePlacementPolicyType.REQUIRED_DOMAIN_DISTRIBUTION] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The type of placement policy for a service fabric service. Following are the possible values. + Required. Indicates that the ServicePlacementPolicyDescription is of type + ServicePlacementRequireDomainDistributionPolicyDescription, indicating that the system will + disallow placement of any two replicas from the same partition in the same domain at any time. + The value is 3.""" + + @overload + def __init__( + self, + *, + domain_name: 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, type=ServicePlacementPolicyType.REQUIRED_DOMAIN_DISTRIBUTION, **kwargs) class ServiceResource(ProxyResource): """The service resource. - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. :vartype id: str - :ivar name: Azure resource name. + :ivar name: The name of the resource. :vartype name: str - :ivar type: Azure resource type. + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". :vartype type: str - :param location: Resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param properties: The service resource properties. - :type properties: - ~service_fabric_managed_clusters_management_client.models.ServiceResourceProperties - """ - - _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"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ServiceResourceProperties"}, - } - - def __init__(self, **kwargs): - super(ServiceResource, self).__init__(**kwargs) - self.properties = kwargs.get("properties", None) - - -class ServiceResourceList(msrest.serialization.Model): - """The list of service resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~service_fabric_managed_clusters_management_client.models.ServiceResource] - :ivar next_link: URL to get the next set of service list results if there are any. - :vartype next_link: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData + :ivar properties: The service resource properties. + :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceProperties + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. + :vartype location: str """ - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get("value", None) - self.next_link = None - - -class ServiceResourcePropertiesBase(msrest.serialization.Model): + properties: Optional["_models.ServiceResourceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The service resource properties.""" + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: Optional[str] = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.ServiceResourceProperties"] = None, + tags: Optional[Dict[str, str]] = None, + location: 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 ServiceResourcePropertiesBase(_Model): """The common service resource properties. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: - list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :vartype correlation_scheme: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: - list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: - list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or - ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: - list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] - """ - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - } - - def __init__(self, **kwargs): - super(ServiceResourcePropertiesBase, self).__init__(**kwargs) - self.placement_constraints = kwargs.get("placement_constraints", None) - self.correlation_scheme = kwargs.get("correlation_scheme", None) - self.service_load_metrics = kwargs.get("service_load_metrics", None) - self.service_placement_policies = kwargs.get("service_placement_policies", None) - self.default_move_cost = kwargs.get("default_move_cost", None) - self.scaling_policies = kwargs.get("scaling_policies", None) + :vartype service_placement_policies: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", and "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] + """ + + placement_constraints: Optional[str] = rest_field( + name="placementConstraints", visibility=["read", "create", "update", "delete", "query"] + ) + """The placement constraints as a string. Placement constraints are boolean expressions on node + properties and allow for restricting a service to particular nodes based on the service + requirements. For example, to place a service on nodes where NodeType is blue specify the + following: \"NodeColor == blue)\".""" + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = rest_field( + name="correlationScheme", visibility=["read", "create", "update", "delete", "query"] + ) + """A list that describes the correlation of the service with other services.""" + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = rest_field( + name="serviceLoadMetrics", visibility=["read", "create", "update", "delete", "query"] + ) + """The service load metrics is given as an array of ServiceLoadMetric objects.""" + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = rest_field( + name="servicePlacementPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """A list that describes the correlation of the service with other services.""" + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = rest_field( + name="defaultMoveCost", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the move cost for the service. Known values are: \"Zero\", \"Low\", \"Medium\", and + \"High\".""" + scaling_policies: Optional[List["_models.ScalingPolicy"]] = rest_field( + name="scalingPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """Scaling policies for this service.""" + + @overload + def __init__( + self, + *, + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = 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 ServiceResourceProperties(ServiceResourcePropertiesBase): """The service resource properties. - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StatefulServiceProperties, StatelessServiceProperties. - - Variables are only populated by the server, and will be ignored when sending a request. + You probably want to use the sub-classes and not this class directly. Known sub-classes are: + StatefulServiceProperties, StatelessServiceProperties - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: - list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :vartype correlation_scheme: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: - list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: - list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or - ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: - list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :vartype service_placement_policies: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", and "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". - :type service_kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: - ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - } - - _subtype_map = { - "service_kind": {"Stateful": "StatefulServiceProperties", "Stateless": "StatelessServiceProperties"} - } - - def __init__(self, **kwargs): - super(ServiceResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.service_kind = "ServiceResourceProperties" # type: str - self.service_type_name = kwargs["service_type_name"] - self.partition_description = kwargs["partition_description"] - self.service_package_activation_mode = kwargs.get("service_package_activation_mode", None) - - -class ServiceTypeHealthPolicy(msrest.serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service type. - - All required parameters must be populated in order to send to Azure. - - :param max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy - services. + :ivar service_kind: The kind of service (Stateless or Stateful). Required. Known values are: + "Stateless" and "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind + :ivar service_type_name: The name of the service type. Required. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. Required. + :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess" and "ExclusiveProcess". + :vartype service_package_activation_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode + :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name + can be used to return the IP addresses of service endpoints for application layer protocols + (e.g., HTTP). + When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new + name. + When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the + name being unresolvable. + :vartype service_dns_name: str + """ + + __mapping__: Dict[str, _Model] = {} + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The current deployment or provisioning state, which only appears in the response.""" + service_kind: str = rest_discriminator( + name="serviceKind", visibility=["read", "create", "update", "delete", "query"] + ) + """The kind of service (Stateless or Stateful). Required. Known values are: \"Stateless\" and + \"Stateful\".""" + service_type_name: str = rest_field( + name="serviceTypeName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the service type. Required.""" + partition_description: "_models.Partition" = rest_field( + name="partitionDescription", visibility=["read", "create", "update", "delete", "query"] + ) + """Describes how the service is partitioned. Required.""" + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = rest_field( + name="servicePackageActivationMode", visibility=["read", "create", "update", "delete", "query"] + ) + """The activation Mode of the service package. Known values are: \"SharedProcess\" and + \"ExclusiveProcess\".""" + service_dns_name: Optional[str] = rest_field( + name="serviceDnsName", visibility=["read", "create", "update", "delete", "query"] + ) + """Dns name used for the service. If this is specified, then the DNS name can be used to return + the IP addresses of service endpoints for application layer protocols (e.g., HTTP). + When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new + name. + When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the + name being unresolvable.""" + + @overload + def __init__( + self, + *, + service_kind: str, + service_type_name: str, + partition_description: "_models.Partition", + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, + service_dns_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 ServiceTypeHealthPolicy(_Model): + """Represents the health policy used to evaluate the health of services belonging to a service + type. + + :ivar max_percent_unhealthy_services: The maximum allowed percentage of unhealthy services. The percentage represents the maximum tolerated percentage of services that can be unhealthy before the application is considered in error. @@ -2347,10 +5115,10 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): evaluated as Warning. This is calculated by dividing the number of unhealthy services of the specific service type over the total number of services of the specific service type. - The computation rounds up to tolerate one failure on small numbers of services. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage - of unhealthy partitions per service. + The computation rounds up to tolerate one failure on small numbers of services. Required. + :vartype max_percent_unhealthy_services: int + :ivar max_percent_unhealthy_partitions_per_service: The maximum allowed percentage of unhealthy + partitions per service. The percentage represents the maximum tolerated percentage of partitions that can be unhealthy before the service is considered in error. @@ -2358,468 +5126,702 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): evaluated as Warning. The percentage is calculated by dividing the number of unhealthy partitions over the total number of partitions in the service. - The computation rounds up to tolerate one failure on small numbers of partitions. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage - of unhealthy replicas per partition. + The computation rounds up to tolerate one failure on small numbers of partitions. Required. + :vartype max_percent_unhealthy_partitions_per_service: int + :ivar max_percent_unhealthy_replicas_per_partition: The maximum allowed percentage of unhealthy + replicas per partition. The percentage represents the maximum tolerated percentage of replicas that can be unhealthy before the partition is considered in error. If the percentage is respected but there is at least one unhealthy replica, the health is evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy replicas over the total - number of replicas in the partition. - The computation rounds up to tolerate one failure on small numbers of replicas. - :type max_percent_unhealthy_replicas_per_partition: int - """ - - _validation = { - "max_percent_unhealthy_services": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_unhealthy_partitions_per_service": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_unhealthy_replicas_per_partition": {"required": True, "maximum": 100, "minimum": 0}, - } - - _attribute_map = { - "max_percent_unhealthy_services": {"key": "maxPercentUnhealthyServices", "type": "int"}, - "max_percent_unhealthy_partitions_per_service": { - "key": "maxPercentUnhealthyPartitionsPerService", - "type": "int", - }, - "max_percent_unhealthy_replicas_per_partition": { - "key": "maxPercentUnhealthyReplicasPerPartition", - "type": "int", - }, - } - - def __init__(self, **kwargs): - super(ServiceTypeHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_services = kwargs["max_percent_unhealthy_services"] - self.max_percent_unhealthy_partitions_per_service = kwargs["max_percent_unhealthy_partitions_per_service"] - self.max_percent_unhealthy_replicas_per_partition = kwargs["max_percent_unhealthy_replicas_per_partition"] - - -class ServiceUpdateParameters(msrest.serialization.Model): - """Service update request. - - :param tags: A set of tags. Service update parameters. - :type tags: dict[str, str] + The percentage is calculated by dividing the number of unhealthy replicas over the total number + of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. Required. + :vartype max_percent_unhealthy_replicas_per_partition: int """ - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, **kwargs): - super(ServiceUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get("tags", None) - - -class SettingsParameterDescription(msrest.serialization.Model): - """Describes a parameter in fabric settings of the cluster. - - All required parameters must be populated in order to send to Azure. + max_percent_unhealthy_services: int = rest_field( + name="maxPercentUnhealthyServices", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy services. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. Required.""" + max_percent_unhealthy_partitions_per_service: int = rest_field( + name="maxPercentUnhealthyPartitionsPerService", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy partitions per service. + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. Required.""" + max_percent_unhealthy_replicas_per_partition: int = rest_field( + name="maxPercentUnhealthyReplicasPerPartition", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum allowed percentage of unhealthy replicas per partition. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total number + of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. Required.""" + + @overload + def __init__( + self, + *, + max_percent_unhealthy_services: int, + max_percent_unhealthy_partitions_per_service: int, + max_percent_unhealthy_replicas_per_partition: int, + ) -> 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 ServiceUpdateParameters(_Model): + """Service update request. - :param name: Required. The parameter name of fabric setting. - :type name: str - :param value: Required. The parameter value of fabric setting. - :type value: str + :ivar tags: Service update parameters. + :vartype tags: dict[str, str] """ - _validation = { - "name": {"required": True}, - "value": {"required": True}, - } + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Service update parameters.""" - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "str"}, - } + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... - def __init__(self, **kwargs): - super(SettingsParameterDescription, self).__init__(**kwargs) - self.name = kwargs["name"] - self.value = kwargs["value"] + @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 SettingsSectionDescription(msrest.serialization.Model): - """Describes a section in the fabric settings of the cluster. - All required parameters must be populated in order to send to Azure. +class SettingsParameterDescription(_Model): + """Describes a parameter in fabric settings of the cluster. - :param name: Required. The section name of the fabric settings. - :type name: str - :param parameters: Required. The collection of parameters in the section. - :type parameters: - list[~service_fabric_managed_clusters_management_client.models.SettingsParameterDescription] + :ivar name: The parameter name of fabric setting. Required. + :vartype name: str + :ivar value: The parameter value of fabric setting. Required. + :vartype value: str """ - _validation = { - "name": {"required": True}, - "parameters": {"required": True}, - } + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parameter name of fabric setting. Required.""" + value: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The parameter value of fabric setting. Required.""" - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "parameters": {"key": "parameters", "type": "[SettingsParameterDescription]"}, - } + @overload + def __init__( + self, + *, + name: str, + value: str, + ) -> None: ... - def __init__(self, **kwargs): - super(SettingsSectionDescription, self).__init__(**kwargs) - self.name = kwargs["name"] - self.parameters = kwargs["parameters"] + @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 SingletonPartitionScheme(Partition): - """SingletonPartitionScheme. - All required parameters must be populated in order to send to Azure. +class SettingsSectionDescription(_Model): + """Describes a section in the fabric settings of the cluster. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or - ~service_fabric_managed_clusters_management_client.models.PartitionScheme + :ivar name: The section name of the fabric settings. Required. + :vartype name: str + :ivar parameters: The collection of parameters in the section. Required. + :vartype parameters: + list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsParameterDescription] """ - _validation = { - "partition_scheme": {"required": True}, - } + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The section name of the fabric settings. Required.""" + parameters: List["_models.SettingsParameterDescription"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The collection of parameters in the section. Required.""" + + @overload + def __init__( + self, + *, + name: str, + parameters: List["_models.SettingsParameterDescription"], + ) -> 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 SingletonPartitionScheme(Partition, discriminator="Singleton"): + """Describes the partition scheme of a singleton-partitioned, or non-partitioned service. + + :ivar partition_scheme: Specifies how the service is partitioned. Required. Indicates that the + partition is based on string names, and is a SingletonPartitionScheme object, The value is 0. + :vartype partition_scheme: str or ~azure.mgmt.servicefabricmanagedclusters.models.SINGLETON + """ - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - } + partition_scheme: Literal[PartitionScheme.SINGLETON] = rest_discriminator(name="partitionScheme", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies how the service is partitioned. Required. Indicates that the partition is based on + string names, and is a SingletonPartitionScheme object, The value is 0.""" - def __init__(self, **kwargs): - super(SingletonPartitionScheme, self).__init__(**kwargs) - self.partition_scheme = "Singleton" # type: str + @overload + def __init__( + self, + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class Sku(msrest.serialization.Model): - """Service Fabric managed cluster Sku definition. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, partition_scheme=PartitionScheme.SINGLETON, **kwargs) - All required parameters must be populated in order to send to Azure. - :param name: Required. Sku Name. Possible values include: "Basic", "Standard". - :type name: str or ~service_fabric_managed_clusters_management_client.models.SkuName - """ +class Sku(_Model): + """Service Fabric managed cluster Sku definition. - _validation = { - "name": {"required": True}, - } + :ivar name: Sku Name. Required. Known values are: "Basic" and "Standard". + :vartype name: str or ~azure.mgmt.servicefabricmanagedclusters.models.SkuName + """ - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } + name: Union[str, "_models.SkuName"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Sku Name. Required. Known values are: \"Basic\" and \"Standard\".""" - def __init__(self, **kwargs): - super(Sku, self).__init__(**kwargs) - self.name = kwargs["name"] + @overload + def __init__( + self, + *, + name: Union[str, "_models.SkuName"], + ) -> None: ... + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ -class StatefulServiceProperties(ServiceResourceProperties): - """The properties of a stateful service resource. + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) - Variables are only populated by the server, and will be ignored when sending a request. - All required parameters must be populated in order to send to Azure. +class StatefulServiceProperties(ServiceResourceProperties, discriminator="Stateful"): + """The properties of a stateful service resource. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: - list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :vartype correlation_scheme: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: - list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: - list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or - ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: - list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :vartype service_placement_policies: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", and "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". - :type service_kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: - ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode - :param has_persisted_state: A flag indicating whether this is a persistent service which stores + :ivar service_type_name: The name of the service type. Required. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. Required. + :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess" and "ExclusiveProcess". + :vartype service_package_activation_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode + :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name + can be used to return the IP addresses of service endpoints for application layer protocols + (e.g., HTTP). + When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new + name. + When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the + name being unresolvable. + :vartype service_dns_name: str + :ivar has_persisted_state: A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false. - :type has_persisted_state: bool - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a + :vartype has_persisted_state: bool + :ivar target_replica_set_size: The target replica set size as a number. + :vartype target_replica_set_size: int + :ivar min_replica_set_size: The minimum replica set size as a number. + :vartype min_replica_set_size: int + :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format "hh:mm:ss". - :type replica_restart_wait_duration: str - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". - :type quorum_loss_wait_duration: str - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: str + :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in + a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". + :vartype quorum_loss_wait_duration: str + :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format "hh:mm:ss". - :type stand_by_replica_keep_duration: str - :param service_placement_time_limit: The duration for which replicas can stay InBuild before + :vartype stand_by_replica_keep_duration: str + :ivar service_placement_time_limit: The duration for which replicas can stay InBuild before reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". - :type service_placement_time_limit: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - "target_replica_set_size": {"minimum": 1}, - "min_replica_set_size": {"minimum": 1}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - "has_persisted_state": {"key": "hasPersistedState", "type": "bool"}, - "target_replica_set_size": {"key": "targetReplicaSetSize", "type": "int"}, - "min_replica_set_size": {"key": "minReplicaSetSize", "type": "int"}, - "replica_restart_wait_duration": {"key": "replicaRestartWaitDuration", "type": "str"}, - "quorum_loss_wait_duration": {"key": "quorumLossWaitDuration", "type": "str"}, - "stand_by_replica_keep_duration": {"key": "standByReplicaKeepDuration", "type": "str"}, - "service_placement_time_limit": {"key": "servicePlacementTimeLimit", "type": "str"}, - } - - def __init__(self, **kwargs): - super(StatefulServiceProperties, self).__init__(**kwargs) - self.service_kind = "Stateful" # type: str - self.has_persisted_state = kwargs.get("has_persisted_state", None) - self.target_replica_set_size = kwargs.get("target_replica_set_size", None) - self.min_replica_set_size = kwargs.get("min_replica_set_size", None) - self.replica_restart_wait_duration = kwargs.get("replica_restart_wait_duration", None) - self.quorum_loss_wait_duration = kwargs.get("quorum_loss_wait_duration", None) - self.stand_by_replica_keep_duration = kwargs.get("stand_by_replica_keep_duration", None) - self.service_placement_time_limit = kwargs.get("service_placement_time_limit", None) - - -class StatelessServiceProperties(ServiceResourceProperties): - """The properties of a stateless service resource. - - Variables are only populated by the server, and will be ignored when sending a request. + :vartype service_placement_time_limit: str + :ivar service_kind: The kind of service (Stateless or Stateful). Required. Uses Service Fabric + to make its state or part of its state highly available and reliable. The value is 1. + :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.STATEFUL + """ - All required parameters must be populated in order to send to Azure. + has_persisted_state: Optional[bool] = rest_field( + name="hasPersistedState", visibility=["read", "create", "update", "delete", "query"] + ) + """A flag indicating whether this is a persistent service which stores states on the local disk. + If it is then the value of this property is true, if not it is false.""" + target_replica_set_size: Optional[int] = rest_field( + name="targetReplicaSetSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The target replica set size as a number.""" + min_replica_set_size: Optional[int] = rest_field( + name="minReplicaSetSize", visibility=["read", "create", "update", "delete", "query"] + ) + """The minimum replica set size as a number.""" + replica_restart_wait_duration: Optional[str] = rest_field( + name="replicaRestartWaitDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration between when a replica goes down and when a new replica is created, represented in + ISO 8601 format \"hh:mm:ss\".""" + quorum_loss_wait_duration: Optional[str] = rest_field( + name="quorumLossWaitDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The maximum duration for which a partition is allowed to be in a state of quorum loss, + represented in ISO 8601 format \"hh:mm:ss\".""" + stand_by_replica_keep_duration: Optional[str] = rest_field( + name="standByReplicaKeepDuration", visibility=["read", "create", "update", "delete", "query"] + ) + """The definition on how long StandBy replicas should be maintained before being removed, + represented in ISO 8601 format \"hh:mm:ss\".""" + service_placement_time_limit: Optional[str] = rest_field( + name="servicePlacementTimeLimit", visibility=["read", "create", "update", "delete", "query"] + ) + """The duration for which replicas can stay InBuild before reporting that build is stuck, + represented in ISO 8601 format \"hh:mm:ss\".""" + service_kind: Literal[ServiceKind.STATEFUL] = rest_discriminator(name="serviceKind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of service (Stateless or Stateful). Required. Uses Service Fabric to make its state or + part of its state highly available and reliable. The value is 1.""" + + @overload + def __init__( + self, + *, + service_type_name: str, + partition_description: "_models.Partition", + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, + service_dns_name: Optional[str] = None, + has_persisted_state: Optional[bool] = None, + target_replica_set_size: Optional[int] = None, + min_replica_set_size: Optional[int] = None, + replica_restart_wait_duration: Optional[str] = None, + quorum_loss_wait_duration: Optional[str] = None, + stand_by_replica_keep_duration: Optional[str] = None, + service_placement_time_limit: 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, service_kind=ServiceKind.STATEFUL, **kwargs) + + +class StatelessServiceProperties(ServiceResourceProperties, discriminator="Stateless"): + """The properties of a stateless service resource. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: - list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :vartype correlation_scheme: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: - list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: - list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or - ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: - list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :vartype service_placement_policies: + list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", and "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Stateless", "Stateful". - :type service_kind: str or - ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: - ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode - :param instance_count: Required. The instance count. - :type instance_count: int - :param min_instance_count: MinInstanceCount is the minimum number of instances that must be up + :ivar service_type_name: The name of the service type. Required. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. Required. + :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess" and "ExclusiveProcess". + :vartype service_package_activation_mode: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode + :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name + can be used to return the IP addresses of service endpoints for application layer protocols + (e.g., HTTP). + When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new + name. + When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the + name being unresolvable. + :vartype service_dns_name: str + :ivar instance_count: The instance count. Required. + :vartype instance_count: int + :ivar min_instance_count: MinInstanceCount is the minimum number of instances that must be up to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 is first converted into the number of nodes on which the instances are allowed to be placed according to the placement constraints on the service. - :type min_instance_count: int - :param min_instance_percentage: MinInstancePercentage is the minimum percentage of - InstanceCount that must be up to meet the EnsureAvailability safety check during operations - like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( + :vartype min_instance_count: int + :ivar min_instance_percentage: MinInstancePercentage is the minimum percentage of InstanceCount + that must be up to meet the EnsureAvailability safety check during operations like upgrade or + deactivate node. The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstancePercentage computation, -1 is first converted into the number of nodes on which the instances are allowed to be placed according to the placement constraints on the service. - :type min_instance_percentage: int - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - "instance_count": {"required": True, "minimum": -1}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - "instance_count": {"key": "instanceCount", "type": "int"}, - "min_instance_count": {"key": "minInstanceCount", "type": "int"}, - "min_instance_percentage": {"key": "minInstancePercentage", "type": "int"}, - } - - def __init__(self, **kwargs): - super(StatelessServiceProperties, self).__init__(**kwargs) - self.service_kind = "Stateless" # type: str - self.instance_count = kwargs["instance_count"] - self.min_instance_count = kwargs.get("min_instance_count", None) - self.min_instance_percentage = kwargs.get("min_instance_percentage", None) - - -class SubResource(msrest.serialization.Model): + :vartype min_instance_percentage: int + :ivar service_kind: The kind of service (Stateless or Stateful). Required. Does not use Service + Fabric to make its state highly available or reliable. The value is 0. + :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.STATELESS + """ + + instance_count: int = rest_field(name="instanceCount", visibility=["read", "create", "update", "delete", "query"]) + """The instance count. Required.""" + min_instance_count: Optional[int] = rest_field( + name="minInstanceCount", visibility=["read", "create", "update", "delete", "query"] + ) + """MinInstanceCount is the minimum number of instances that must be up to meet the + EnsureAvailability safety check during operations like upgrade or deactivate node. The actual + number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * + InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 + is first converted into the number of nodes on which the instances are allowed to be placed + according to the placement constraints on the service.""" + min_instance_percentage: Optional[int] = rest_field( + name="minInstancePercentage", visibility=["read", "create", "update", "delete", "query"] + ) + """MinInstancePercentage is the minimum percentage of InstanceCount that must be up to meet the + EnsureAvailability safety check during operations like upgrade or deactivate node. The actual + number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * + InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstancePercentage + computation, -1 is first converted into the number of nodes on which the instances are allowed + to be placed according to the placement constraints on the service.""" + service_kind: Literal[ServiceKind.STATELESS] = rest_discriminator(name="serviceKind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of service (Stateless or Stateful). Required. Does not use Service Fabric to make its + state highly available or reliable. The value is 0.""" + + @overload + def __init__( + self, + *, + service_type_name: str, + partition_description: "_models.Partition", + instance_count: int, + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, + scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, + service_dns_name: Optional[str] = None, + min_instance_count: Optional[int] = None, + min_instance_percentage: 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, service_kind=ServiceKind.STATELESS, **kwargs) + + +class Subnet(_Model): + """Describes a Subnet. + + :ivar name: Subnet name. Required. + :vartype name: str + :ivar enable_ipv6: Indicates wether to enable Ipv6 or not. If not provided, it will take the + same configuration as the cluster. + :vartype enable_ipv6: bool + :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private + end point in the subnet. Known values are: "enabled" and "disabled". + :vartype private_endpoint_network_policies: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies + :ivar private_link_service_network_policies: Enable or Disable apply network policies on + private link service in the subnet. Known values are: "enabled" and "disabled". + :vartype private_link_service_network_policies: str or + ~azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies + :ivar network_security_group_id: Full resource id for the network security group. + :vartype network_security_group_id: str + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Subnet name. Required.""" + enable_ipv6: Optional[bool] = rest_field( + name="enableIpv6", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates wether to enable Ipv6 or not. If not provided, it will take the same configuration as + the cluster.""" + private_endpoint_network_policies: Optional[Union[str, "_models.PrivateEndpointNetworkPolicies"]] = rest_field( + name="privateEndpointNetworkPolicies", visibility=["read", "create", "update", "delete", "query"] + ) + """Enable or Disable apply network policies on private end point in the subnet. Known values are: + \"enabled\" and \"disabled\".""" + private_link_service_network_policies: Optional[Union[str, "_models.PrivateLinkServiceNetworkPolicies"]] = ( + rest_field(name="privateLinkServiceNetworkPolicies", visibility=["read", "create", "update", "delete", "query"]) + ) + """Enable or Disable apply network policies on private link service in the subnet. Known values + are: \"enabled\" and \"disabled\".""" + network_security_group_id: Optional[str] = rest_field( + name="networkSecurityGroupId", visibility=["read", "create", "update", "delete", "query"] + ) + """Full resource id for the network security group.""" + + @overload + def __init__( + self, + *, + name: str, + enable_ipv6: Optional[bool] = None, + private_endpoint_network_policies: Optional[Union[str, "_models.PrivateEndpointNetworkPolicies"]] = None, + private_link_service_network_policies: Optional[Union[str, "_models.PrivateLinkServiceNetworkPolicies"]] = None, + network_security_group_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 SubResource(_Model): """Azure resource identifier. - :param id: Azure resource identifier. - :type id: str + :ivar id: Azure resource identifier. + :vartype id: str """ - _attribute_map = { - "id": {"key": "id", "type": "str"}, - } + id: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Azure resource identifier.""" + + @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, **kwargs): - super(SubResource, self).__init__(**kwargs) - self.id = kwargs.get("id", None) + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) -class SystemData(msrest.serialization.Model): +class SystemData(_Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - :type created_by_type: str - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. - :type last_modified_by_type: str - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__(self, **kwargs): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get("created_by", None) - self.created_by_type = kwargs.get("created_by_type", None) - self.created_at = kwargs.get("created_at", None) - self.last_modified_by = kwargs.get("last_modified_by", None) - self.last_modified_by_type = kwargs.get("last_modified_by_type", None) - self.last_modified_at = kwargs.get("last_modified_at", None) - - -class UniformInt64RangePartitionScheme(Partition): - """Describes a partitioning scheme where an integer range is allocated evenly across a number of partitions. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or - ~service_fabric_managed_clusters_management_client.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. The lower bound of the partition key range that - should be split between the partition ‘Count’. - :type low_key: long - :param high_key: Required. The upper bound of the partition key range that - should be split between the partition ‘Count’. - :type high_key: long - """ - - _validation = { - "partition_scheme": {"required": True}, - "count": {"required": True}, - "low_key": {"required": True}, - "high_key": {"required": True}, - } - - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "low_key": {"key": "lowKey", "type": "long"}, - "high_key": {"key": "highKey", "type": "long"}, - } - - def __init__(self, **kwargs): - super(UniformInt64RangePartitionScheme, self).__init__(**kwargs) - self.partition_scheme = "UniformInt64Range" # type: str - self.count = kwargs["count"] - self.low_key = kwargs["low_key"] - self.high_key = kwargs["high_key"] - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. + :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.servicefabricmanagedclusters.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.servicefabricmanagedclusters.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 UniformInt64RangePartitionScheme(Partition, discriminator="UniformInt64Range"): + """Describes a partitioning scheme where an integer range is allocated evenly across a number of + partitions. + + :ivar count: The number of partitions. Required. + :vartype count: int + :ivar low_key: The lower bound of the partition key range that + should be split between the partition ‘Count’. Required. + :vartype low_key: int + :ivar high_key: The upper bound of the partition key range that + should be split between the partition ‘Count’. Required. + :vartype high_key: int + :ivar partition_scheme: Specifies how the service is partitioned. Required. Indicates that the + partition is based on Int64 key ranges, and is a UniformInt64RangePartitionScheme object. The + value is 1. + :vartype partition_scheme: str or + ~azure.mgmt.servicefabricmanagedclusters.models.UNIFORM_INT64_RANGE + """ + + count: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The number of partitions. Required.""" + low_key: int = rest_field(name="lowKey", visibility=["read", "create", "update", "delete", "query"]) + """The lower bound of the partition key range that + should be split between the partition ‘Count’. Required.""" + high_key: int = rest_field(name="highKey", visibility=["read", "create", "update", "delete", "query"]) + """The upper bound of the partition key range that + should be split between the partition ‘Count’. Required.""" + partition_scheme: Literal[PartitionScheme.UNIFORM_INT64_RANGE] = rest_discriminator(name="partitionScheme", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """Specifies how the service is partitioned. Required. Indicates that the partition is based on + Int64 key ranges, and is a UniformInt64RangePartitionScheme object. The value is 1.""" + + @overload + def __init__( + self, + *, + count: int, + low_key: int, + high_key: int, + ) -> 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, partition_scheme=PartitionScheme.UNIFORM_INT64_RANGE, **kwargs) + + +class UserAssignedIdentity(_Model): + """User assigned identity. :ivar principal_id: The principal id of user assigned identity. :vartype principal_id: str @@ -2827,173 +5829,532 @@ class UserAssignedIdentity(msrest.serialization.Model): :vartype client_id: str """ - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } + principal_id: Optional[str] = rest_field(name="principalId", visibility=["read"]) + """The principal id of user assigned identity.""" + client_id: Optional[str] = rest_field(name="clientId", visibility=["read"]) + """The client id of user assigned identity.""" + + +class VaultCertificate(_Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should + reside on the VM. + + :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as + a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault + `_. Required. + :vartype certificate_url: str + :ivar certificate_store: For Windows VMs, specifies the certificate store on the Virtual + Machine to which the certificate should be added. The specified certificate store is implicitly + in the LocalMachine account. For Linux VMs, the certificate file is placed under the + /var/lib/waagent directory, with the file name {UppercaseThumbprint}.crt for the X509 + certificate file and {UppercaseThumbprint}.prv for private key. Both of these files are .pem + formatted. Required. + :vartype certificate_store: str + """ - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } + certificate_url: str = rest_field(name="certificateUrl", visibility=["read", "create", "update", "delete", "query"]) + """This is the URL of a certificate that has been uploaded to Key Vault as a secret. For adding a + secret to the Key Vault, see `Add a key or secret to the key vault + `_. Required.""" + certificate_store: str = rest_field( + name="certificateStore", visibility=["read", "create", "update", "delete", "query"] + ) + """For Windows VMs, specifies the certificate store on the Virtual Machine to which the + certificate should be added. The specified certificate store is implicitly in the LocalMachine + account. For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, + with the file name {UppercaseThumbprint}.crt for the X509 certificate file and + {UppercaseThumbprint}.prv for private key. Both of these files are .pem formatted. Required.""" + + @overload + def __init__( + self, + *, + certificate_url: str, + certificate_store: 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 VaultSecretGroup(_Model): + """Specifies set of certificates that should be installed onto the virtual machines. - def __init__(self, **kwargs): - super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None + :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in + VaultCertificates. Required. + :vartype source_vault: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource + :ivar vault_certificates: The list of key vault references in SourceVault which contain + certificates. Required. + :vartype vault_certificates: + list[~azure.mgmt.servicefabricmanagedclusters.models.VaultCertificate] + """ + source_vault: "_models.SubResource" = rest_field( + name="sourceVault", visibility=["read", "create", "update", "delete", "query"] + ) + """The relative URL of the Key Vault containing all of the certificates in VaultCertificates. + Required.""" + vault_certificates: List["_models.VaultCertificate"] = rest_field( + name="vaultCertificates", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of key vault references in SourceVault which contain certificates. Required.""" + + @overload + def __init__( + self, + *, + source_vault: "_models.SubResource", + vault_certificates: List["_models.VaultCertificate"], + ) -> 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 VmApplication(_Model): + """Specifies the gallery application that should be made available to the underlying VMSS. + + :ivar configuration_reference: Optional, Specifies the uri to an azure blob that will replace + the default configuration for the package if provided. + :vartype configuration_reference: str + :ivar enable_automatic_upgrade: If set to true, when a new Gallery Application version is + available in PIR/SIG, it will be automatically updated for the underlying VMSS. + :vartype enable_automatic_upgrade: bool + :ivar order: Optional, Specifies the order in which the packages have to be installed. + :vartype order: int + :ivar package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + Required. + :vartype package_reference_id: str + :ivar vm_gallery_tags: Optional, Specifies a passthrough value for more generic context. + Accepts a JSON-formatted string e.g. '{"Tag1":"Value1","Tag2":"Value2"}'. + :vartype vm_gallery_tags: str + :ivar treat_failure_as_deployment_failure: Optional, If true, any failure for any operation in + the VmApplication will fail the deployment. + :vartype treat_failure_as_deployment_failure: bool + """ -class VaultCertificate(msrest.serialization.Model): - """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. + configuration_reference: Optional[str] = rest_field( + name="configurationReference", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional, Specifies the uri to an azure blob that will replace the default configuration for + the package if provided.""" + enable_automatic_upgrade: Optional[bool] = rest_field( + name="enableAutomaticUpgrade", visibility=["read", "create", "update", "delete", "query"] + ) + """If set to true, when a new Gallery Application version is available in PIR/SIG, it will be + automatically updated for the underlying VMSS.""" + order: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Optional, Specifies the order in which the packages have to be installed.""" + package_reference_id: str = rest_field( + name="packageReferenceId", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the GalleryApplicationVersion resource id on the form of + /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. + Required.""" + vm_gallery_tags: Optional[str] = rest_field( + name="vmGalleryTags", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional, Specifies a passthrough value for more generic context. Accepts a JSON-formatted + string e.g. '{\"Tag1\":\"Value1\",\"Tag2\":\"Value2\"}'.""" + treat_failure_as_deployment_failure: Optional[bool] = rest_field( + name="treatFailureAsDeploymentFailure", visibility=["read", "create", "update", "delete", "query"] + ) + """Optional, If true, any failure for any operation in the VmApplication will fail the deployment.""" + + @overload + def __init__( + self, + *, + package_reference_id: str, + configuration_reference: Optional[str] = None, + enable_automatic_upgrade: Optional[bool] = None, + order: Optional[int] = None, + vm_gallery_tags: Optional[str] = None, + treat_failure_as_deployment_failure: 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 VmImagePlan(_Model): + """Specifies information about the marketplace image used to create the virtual machine. This + element is only used for marketplace images. Before you can use a marketplace image from an + API, you must enable the image for programmatic use. In the Azure portal, find the marketplace + image that you want to use and then click Want to deploy programmatically, Get Started. Enter + any required information and then click Save. + + :ivar name: The plan ID. + :vartype name: str + :ivar product: Specifies the product of the image from the marketplace. This is the same value + as Offer under the imageReference element. + :vartype product: str + :ivar promotion_code: The promotion code. + :vartype promotion_code: str + :ivar publisher: The publisher ID. + :vartype publisher: str + """ - All required parameters must be populated in order to send to Azure. + name: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The plan ID.""" + product: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the product of the image from the marketplace. This is the same value as Offer under + the imageReference element.""" + promotion_code: Optional[str] = rest_field( + name="promotionCode", visibility=["read", "create", "update", "delete", "query"] + ) + """The promotion code.""" + publisher: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The publisher ID.""" + + @overload + def __init__( + self, + *, + name: Optional[str] = None, + product: Optional[str] = None, + promotion_code: Optional[str] = None, + publisher: 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 VmManagedIdentity(_Model): + """Identities for the virtual machine scale set under the node type. - :param certificate_url: Required. This is the URL of a certificate that has been uploaded to - Key Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the - key vault `_. In this - case, your certificate needs to be It is the Base64 encoding of the following JSON Object which - is encoded in UTF-8: :code:`
`:code:`
` {:code:`
` - "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` - "password":":code:``":code:`
`}. - :type certificate_url: str - :param certificate_store: Required. For Windows VMs, specifies the certificate store on the - Virtual Machine to which the certificate should be added. The specified certificate store is - implicitly in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate - file is placed under the /var/lib/waagent directory, with the file name - :code:``.crt for the X509 certificate file and - :code:``.prv for private key. Both of these files are .pem formatted. - :type certificate_store: str + :ivar user_assigned_identities: The list of user identities associated with the virtual machine + scale set under the node type. Each entry will be an ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :vartype user_assigned_identities: list[str] """ - _validation = { - "certificate_url": {"required": True}, - "certificate_store": {"required": True}, - } + user_assigned_identities: Optional[List[str]] = rest_field( + name="userAssignedIdentities", visibility=["read", "create", "update", "delete", "query"] + ) + """The list of user identities associated with the virtual machine scale set under the node type. + Each entry will be an ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.""" - _attribute_map = { - "certificate_url": {"key": "certificateUrl", "type": "str"}, - "certificate_store": {"key": "certificateStore", "type": "str"}, - } + @overload + def __init__( + self, + *, + user_assigned_identities: Optional[List[str]] = None, + ) -> None: ... - def __init__(self, **kwargs): - super(VaultCertificate, self).__init__(**kwargs) - self.certificate_url = kwargs["certificate_url"] - self.certificate_store = kwargs["certificate_store"] + @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 VaultSecretGroup(msrest.serialization.Model): - """Specifies set of certificates that should be installed onto the virtual machines. - All required parameters must be populated in order to send to Azure. +class VMSize(_Model): + """VM Sizes properties. - :param source_vault: Required. The relative URL of the Key Vault containing all of the - certificates in VaultCertificates. - :type source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource - :param vault_certificates: Required. The list of key vault references in SourceVault which - contain certificates. - :type vault_certificates: - list[~service_fabric_managed_clusters_management_client.models.VaultCertificate] + :ivar size: VM Size name. + :vartype size: str """ - _validation = { - "source_vault": {"required": True}, - "vault_certificates": {"required": True}, - } - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SubResource"}, - "vault_certificates": {"key": "vaultCertificates", "type": "[VaultCertificate]"}, - } - - def __init__(self, **kwargs): - super(VaultSecretGroup, self).__init__(**kwargs) - self.source_vault = kwargs["source_vault"] - self.vault_certificates = kwargs["vault_certificates"] - - -class VmManagedIdentity(msrest.serialization.Model): - """Identities for the virtual machine scale set under the node type. - - :param user_assigned_identities: The list of user identities associated with the virtual - machine scale set under the node type. Each entry will be an ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: list[str] + size: Optional[str] = rest_field(visibility=["read"]) + """VM Size name.""" + + +class VmssDataDisk(_Model): + """Managed data disk description. + + :ivar lun: Specifies the logical unit number of the data disk. This value is used to identify + data disks within the VM and therefore must be unique for each data disk attached to a VM. Lun + 0 is reserved for the service fabric data disk. Required. + :vartype lun: int + :ivar disk_size_gb: Disk size for each vm in the node type in GBs. Required. + :vartype disk_size_gb: int + :ivar disk_type: Managed data disk type. Specifies the storage account type for the managed + disk. Required. Known values are: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS", + "PremiumV2_LRS", "StandardSSD_ZRS", and "Premium_ZRS". + :vartype disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType + :ivar disk_letter: Managed data disk letter. It can not use the reserved letter C or D and it + can not change after created. Required. + :vartype disk_letter: str """ - _attribute_map = { - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[str]"}, - } - - def __init__(self, **kwargs): - super(VmManagedIdentity, self).__init__(**kwargs) - self.user_assigned_identities = kwargs.get("user_assigned_identities", None) - - -class VMSSExtension(msrest.serialization.Model): + lun: int = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the logical unit number of the data disk. This value is used to identify data disks + within the VM and therefore must be unique for each data disk attached to a VM. Lun 0 is + reserved for the service fabric data disk. Required.""" + disk_size_gb: int = rest_field(name="diskSizeGB", visibility=["read", "create", "update", "delete", "query"]) + """Disk size for each vm in the node type in GBs. Required.""" + disk_type: Union[str, "_models.DiskType"] = rest_field( + name="diskType", visibility=["read", "create", "update", "delete", "query"] + ) + """Managed data disk type. Specifies the storage account type for the managed disk. Required. + Known values are: \"Standard_LRS\", \"StandardSSD_LRS\", \"Premium_LRS\", \"PremiumV2_LRS\", + \"StandardSSD_ZRS\", and \"Premium_ZRS\".""" + disk_letter: str = rest_field(name="diskLetter", visibility=["read", "create", "update", "delete", "query"]) + """Managed data disk letter. It can not use the reserved letter C or D and it can not change after + created. Required.""" + + @overload + def __init__( + self, + *, + lun: int, + disk_size_gb: int, + disk_type: Union[str, "_models.DiskType"], + disk_letter: 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 VMSSExtension(_Model): """Specifies set of extensions that should be installed onto the virtual machines. - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. + :ivar name: The name of the extension. Required. + :vartype name: str + :ivar properties: Describes the properties of a Virtual Machine Scale Set Extension. Required. + :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.VMSSExtensionProperties + """ - :param name: Required. The name of the extension. - :type name: str - :param publisher: Required. The name of the extension handler publisher. - :type publisher: str - :param type: Required. Specifies the type of the extension; an example is - "CustomScriptExtension". - :type type: str - :param type_handler_version: Required. Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension. Required.""" + properties: "_models.VMSSExtensionProperties" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Describes the properties of a Virtual Machine Scale Set Extension. Required.""" + + __flattened_items = [ + "publisher", + "type", + "type_handler_version", + "auto_upgrade_minor_version", + "settings", + "protected_settings", + "force_update_tag", + "provision_after_extensions", + "provisioning_state", + "enable_automatic_upgrade", + "setup_order", + ] + + @overload + def __init__( + self, + *, + name: str, + properties: "_models.VMSSExtensionProperties", + ) -> 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 VMSSExtensionProperties(_Model): + """Describes the properties of a Virtual Machine Scale Set Extension. + + :ivar publisher: The name of the extension handler publisher. Required. + :vartype publisher: str + :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". + Required. + :vartype type: str + :ivar type_handler_version: Specifies the version of the script handler. Required. + :vartype type_handler_version: str + :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. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - :param force_update_tag: If a value is provided and is different from the previous value, the + :vartype protected_settings: any + :ivar force_update_tag: If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. - :type force_update_tag: str - :param provision_after_extensions: Collection of extension names after which this extension + :vartype force_update_tag: str + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :vartype enable_automatic_upgrade: bool + :ivar setup_order: Indicates the setup order for the extension. + :vartype setup_order: list[str or + ~azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder] + """ + + publisher: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extension handler publisher. Required.""" + type: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Specifies the type of the extension; an example is \"CustomScriptExtension\". Required.""" + type_handler_version: str = rest_field( + name="typeHandlerVersion", visibility=["read", "create", "update", "delete", "query"] + ) + """Specifies the version of the script handler. Required.""" + 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[Any] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Json formatted public settings for the extension.""" + protected_settings: Optional[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.""" + force_update_tag: Optional[str] = rest_field( + name="forceUpdateTag", visibility=["read", "create", "update", "delete", "query"] + ) + """If a value is provided and is different from the previous value, the extension handler will be + forced to update even if the extension configuration has not changed.""" + provision_after_extensions: Optional[List[str]] = rest_field( + name="provisionAfterExtensions", visibility=["read", "create", "update", "delete", "query"] + ) + """Collection of extension names after which this extension needs to be provisioned.""" + provisioning_state: Optional[str] = rest_field(name="provisioningState", visibility=["read"]) + """The provisioning state, which only appears in the response.""" + 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 of the extension available.""" + setup_order: Optional[List[Union[str, "_models.VmssExtensionSetupOrder"]]] = rest_field( + name="setupOrder", visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates the setup order for the extension.""" + + @overload + def __init__( + self, + *, + publisher: str, + type: str, + type_handler_version: str, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, + force_update_tag: Optional[str] = None, + provision_after_extensions: Optional[List[str]] = None, + enable_automatic_upgrade: Optional[bool] = None, + setup_order: Optional[List[Union[str, "_models.VmssExtensionSetupOrder"]]] = 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 ZoneFaultSimulationContent(FaultSimulationContent, discriminator="Zone"): + """Parameters for Zone Fault Simulation action. + + :ivar force: Force the action to go through without any check on the cluster. + :vartype force: bool + :ivar constraints: Constraints for Fault Simulation action. + :vartype constraints: + ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationConstraints + :ivar zones: Indicates the zones of the fault simulation. + :vartype zones: list[str] + :ivar fault_kind: The kind of fault simulation. Required. Simulates an availability zone down. + :vartype fault_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ZONE """ - _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "type": {"required": True}, - "type_handler_version": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "provision_after_extensions": {"key": "properties.provisionAfterExtensions", "type": "[str]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, **kwargs): - super(VMSSExtension, self).__init__(**kwargs) - self.name = kwargs["name"] - self.publisher = kwargs["publisher"] - self.type = kwargs["type"] - self.type_handler_version = kwargs["type_handler_version"] - self.auto_upgrade_minor_version = kwargs.get("auto_upgrade_minor_version", None) - self.settings = kwargs.get("settings", None) - self.protected_settings = kwargs.get("protected_settings", None) - self.force_update_tag = kwargs.get("force_update_tag", None) - self.provision_after_extensions = kwargs.get("provision_after_extensions", None) - self.provisioning_state = None + zones: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Indicates the zones of the fault simulation.""" + fault_kind: Literal[FaultKind.ZONE] = rest_discriminator(name="faultKind", visibility=["read", "create", "update", "delete", "query"]) # type: ignore + """The kind of fault simulation. Required. Simulates an availability zone down.""" + + @overload + def __init__( + self, + *, + force: Optional[bool] = None, + constraints: Optional["_models.FaultSimulationConstraints"] = None, + zones: 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, fault_kind=FaultKind.ZONE, **kwargs) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py deleted file mode 100644 index d28341e8dc3b..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py +++ /dev/null @@ -1,6302 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -import datetime -import sys -from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union - -from .. import _serialization - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore - -if TYPE_CHECKING: - from .. import models as _models -JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object - - -class AdditionalNetworkInterfaceConfiguration(_serialization.Model): - """Specifies the settings for a network interface to attach to the node type. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the network interface. Required. - :vartype name: str - :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :vartype enable_accelerated_networking: bool - :ivar dscp_configuration: Specifies the DSCP configuration to apply to the network interface. - :vartype dscp_configuration: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :ivar ip_configurations: Specifies the IP configurations of the network interface. Required. - :vartype ip_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration] - """ - - _validation = { - "name": {"required": True}, - "ip_configurations": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "enable_accelerated_networking": {"key": "enableAcceleratedNetworking", "type": "bool"}, - "dscp_configuration": {"key": "dscpConfiguration", "type": "SubResource"}, - "ip_configurations": {"key": "ipConfigurations", "type": "[IpConfiguration]"}, - } - - def __init__( - self, - *, - name: str, - ip_configurations: List["_models.IpConfiguration"], - enable_accelerated_networking: Optional[bool] = None, - dscp_configuration: Optional["_models.SubResource"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the network interface. Required. - :paramtype name: str - :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :paramtype enable_accelerated_networking: bool - :keyword dscp_configuration: Specifies the DSCP configuration to apply to the network - interface. - :paramtype dscp_configuration: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :keyword ip_configurations: Specifies the IP configurations of the network interface. Required. - :paramtype ip_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.IpConfiguration] - """ - super().__init__(**kwargs) - self.name = name - self.enable_accelerated_networking = enable_accelerated_networking - self.dscp_configuration = dscp_configuration - self.ip_configurations = ip_configurations - - -class ScalingMechanism(_serialization.Model): - """Describes the mechanism for performing a scaling operation. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AddRemoveIncrementalNamedPartitionScalingMechanism, PartitionInstanceCountScaleMechanism - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the mechanism associated with this scaling policy. Required. Known values - are: "ScalePartitionInstanceCount" and "AddRemoveIncrementalNamedPartition". - :vartype kind: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind - """ - - _validation = { - "kind": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - } - - _subtype_map = { - "kind": { - "AddRemoveIncrementalNamedPartition": "AddRemoveIncrementalNamedPartitionScalingMechanism", - "ScalePartitionInstanceCount": "PartitionInstanceCountScaleMechanism", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kind: Optional[str] = None - - -class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): # pylint: disable=name-too-long - """Represents a scaling mechanism for adding or removing named partitions of a stateless service. - Partition names are in the format '0','1'...'N-1'. - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the mechanism associated with this scaling policy. Required. Known values - are: "ScalePartitionInstanceCount" and "AddRemoveIncrementalNamedPartition". - :vartype kind: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind - :ivar min_partition_count: Minimum number of named partitions of the service. Required. - :vartype min_partition_count: int - :ivar max_partition_count: Maximum number of named partitions of the service. Required. - :vartype max_partition_count: int - :ivar scale_increment: The number of instances to add or remove during a scaling operation. - Required. - :vartype scale_increment: int - """ - - _validation = { - "kind": {"required": True}, - "min_partition_count": {"required": True}, - "max_partition_count": {"required": True}, - "scale_increment": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "min_partition_count": {"key": "minPartitionCount", "type": "int"}, - "max_partition_count": {"key": "maxPartitionCount", "type": "int"}, - "scale_increment": {"key": "scaleIncrement", "type": "int"}, - } - - def __init__( - self, *, min_partition_count: int, max_partition_count: int, scale_increment: int, **kwargs: Any - ) -> None: - """ - :keyword min_partition_count: Minimum number of named partitions of the service. Required. - :paramtype min_partition_count: int - :keyword max_partition_count: Maximum number of named partitions of the service. Required. - :paramtype max_partition_count: int - :keyword scale_increment: The number of instances to add or remove during a scaling operation. - Required. - :paramtype scale_increment: int - """ - super().__init__(**kwargs) - self.kind: str = "AddRemoveIncrementalNamedPartition" - self.min_partition_count = min_partition_count - self.max_partition_count = max_partition_count - self.scale_increment = scale_increment - - -class ApplicationHealthPolicy(_serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children - entities. - - All required parameters must be populated in order to send to server. - - :ivar consider_warning_as_error: Indicates whether warnings are treated with the same severity - as errors. Required. - :vartype consider_warning_as_error: bool - :ivar max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy - deployed applications. Allowed values are Byte values from zero to 100. - The percentage represents the maximum tolerated percentage of deployed applications that can - be unhealthy before the application is considered in error. - This is calculated by dividing the number of unhealthy deployed applications over the number - of nodes where the application is currently deployed on in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. Required. - :vartype max_percent_unhealthy_deployed_applications: int - :ivar default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :vartype default_service_type_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy - :ivar service_type_health_policy_map: The map with service type health policy per service type - name. The map is empty by default. - :vartype service_type_health_policy_map: dict[str, - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy] - """ - - _validation = { - "consider_warning_as_error": {"required": True}, - "max_percent_unhealthy_deployed_applications": {"required": True}, - } - - _attribute_map = { - "consider_warning_as_error": {"key": "considerWarningAsError", "type": "bool"}, - "max_percent_unhealthy_deployed_applications": { - "key": "maxPercentUnhealthyDeployedApplications", - "type": "int", - }, - "default_service_type_health_policy": { - "key": "defaultServiceTypeHealthPolicy", - "type": "ServiceTypeHealthPolicy", - }, - "service_type_health_policy_map": {"key": "serviceTypeHealthPolicyMap", "type": "{ServiceTypeHealthPolicy}"}, - } - - def __init__( - self, - *, - consider_warning_as_error: bool, - max_percent_unhealthy_deployed_applications: int, - default_service_type_health_policy: Optional["_models.ServiceTypeHealthPolicy"] = None, - service_type_health_policy_map: Optional[Dict[str, "_models.ServiceTypeHealthPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword consider_warning_as_error: Indicates whether warnings are treated with the same - severity as errors. Required. - :paramtype consider_warning_as_error: bool - :keyword max_percent_unhealthy_deployed_applications: The maximum allowed percentage of - unhealthy deployed applications. Allowed values are Byte values from zero to 100. - The percentage represents the maximum tolerated percentage of deployed applications that can - be unhealthy before the application is considered in error. - This is calculated by dividing the number of unhealthy deployed applications over the number - of nodes where the application is currently deployed on in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. Required. - :paramtype max_percent_unhealthy_deployed_applications: int - :keyword default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :paramtype default_service_type_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy - :keyword service_type_health_policy_map: The map with service type health policy per service - type name. The map is empty by default. - :paramtype service_type_health_policy_map: dict[str, - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceTypeHealthPolicy] - """ - super().__init__(**kwargs) - self.consider_warning_as_error = consider_warning_as_error - self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications - self.default_service_type_health_policy = default_service_type_health_policy - self.service_type_health_policy_map = service_type_health_policy_map - - -class ProxyResource(_serialization.Model): - """The resource model definition for proxy-only resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location depends on the parent resource. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.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"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location depends on the parent resource. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - - -class ApplicationResource(ProxyResource): - """The application resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location depends on the parent resource. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar identity: Describes the managed identities for an Azure resource. - :vartype identity: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentity - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :ivar version: The version of the application type as defined in the application manifest. - This name must be the full Arm Resource ID for the referenced application type version. - :vartype version: str - :ivar parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :vartype parameters: dict[str, str] - :ivar upgrade_policy: Describes the policy for a monitored application upgrade. - :vartype upgrade_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpgradePolicy - :ivar managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :vartype managed_identities: - list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "identity": {"key": "identity", "type": "ManagedIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "version": {"key": "properties.version", "type": "str"}, - "parameters": {"key": "properties.parameters", "type": "{str}"}, - "upgrade_policy": {"key": "properties.upgradePolicy", "type": "ApplicationUpgradePolicy"}, - "managed_identities": {"key": "properties.managedIdentities", "type": "[ApplicationUserAssignedIdentity]"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedIdentity"] = None, - version: Optional[str] = None, - parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, - managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location depends on the parent resource. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Describes the managed identities for an Azure resource. - :paramtype identity: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentity - :keyword version: The version of the application type as defined in the application manifest. - This name must be the full Arm Resource ID for the referenced application type version. - :paramtype version: str - :keyword parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :paramtype parameters: dict[str, str] - :keyword upgrade_policy: Describes the policy for a monitored application upgrade. - :paramtype upgrade_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpgradePolicy - :keyword managed_identities: List of user assigned identities for the application, each mapped - to a friendly name. - :paramtype managed_identities: - list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUserAssignedIdentity] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.identity = identity - self.provisioning_state = None - self.version = version - self.parameters = parameters - self.upgrade_policy = upgrade_policy - self.managed_identities = managed_identities - - -class ApplicationResourceList(_serialization.Model): - """The list of application resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :ivar next_link: URL to get the next set of application list results if there are any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ApplicationResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ApplicationTypeResource(ProxyResource): - """The application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location depends on the parent resource. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Resource location depends on the parent resource. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - - -class ApplicationTypeResourceList(_serialization.Model): - """The list of application type names. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] - :ivar next_link: URL to get the next set of application type list results if there are any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationTypeResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ApplicationTypeResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ApplicationTypeUpdateParameters(_serialization.Model): - """Application type update request. - - :ivar tags: Application type update parameters. - :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: Application type update parameters. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ApplicationTypeVersionResource(ProxyResource): - """An application type version resource for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location depends on the parent resource. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :ivar app_package_url: The URL to the application package. - :vartype app_package_url: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "app_package_url": {"key": "properties.appPackageUrl", "type": "str"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - app_package_url: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location depends on the parent resource. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - :keyword app_package_url: The URL to the application package. - :paramtype app_package_url: str - """ - super().__init__(location=location, tags=tags, **kwargs) - self.provisioning_state = None - self.app_package_url = app_package_url - - -class ApplicationTypeVersionResourceList(_serialization.Model): - """The list of application type version resources for the specified application type name - resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: - list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :ivar next_link: URL to get the next set of application type version list results if there are - any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ApplicationTypeVersionResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ApplicationTypeVersionResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: - list[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ApplicationTypeVersionsCleanupPolicy(_serialization.Model): - """The policy used to clean up unused versions. When the policy is not specified explicitly, the - default unused application versions to keep will be 3. - - All required parameters must be populated in order to send to server. - - :ivar max_unused_versions_to_keep: Number of unused versions per application type to keep. - Required. - :vartype max_unused_versions_to_keep: int - """ - - _validation = { - "max_unused_versions_to_keep": {"required": True, "minimum": 0}, - } - - _attribute_map = { - "max_unused_versions_to_keep": {"key": "maxUnusedVersionsToKeep", "type": "int"}, - } - - def __init__(self, *, max_unused_versions_to_keep: int, **kwargs: Any) -> None: - """ - :keyword max_unused_versions_to_keep: Number of unused versions per application type to keep. - Required. - :paramtype max_unused_versions_to_keep: int - """ - super().__init__(**kwargs) - self.max_unused_versions_to_keep = max_unused_versions_to_keep - - -class ApplicationTypeVersionUpdateParameters(_serialization.Model): - """Application type version update request. - - :ivar tags: Application type version update parameters. - :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: Application type version update parameters. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ApplicationUpdateParameters(_serialization.Model): - """Application update request. - - :ivar tags: Application update parameters. - :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: Application update parameters. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ApplicationUpgradePolicy(_serialization.Model): - """Describes the policy for a monitored application upgrade. - - :ivar application_health_policy: Defines a health policy used to evaluate the health of an - application or one of its children entities. - :vartype application_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationHealthPolicy - :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :vartype force_restart: bool - :ivar rolling_upgrade_monitoring_policy: The policy used for monitoring the application - upgrade. - :vartype rolling_upgrade_monitoring_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMonitoringPolicy - :ivar instance_close_delay_duration: Duration in seconds, to wait before a stateless instance - is closed, to allow the active requests to drain gracefully. This would be effective when the - instance is closing during the application/cluster upgrade, only for those instances which have - a non-zero delay duration configured in the service description. - :vartype instance_close_delay_duration: int - :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - Monitored, and UnmonitoredAuto. Known values are: "Monitored" and "UnmonitoredAuto". - :vartype upgrade_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode - :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an - upgrade domain and prevent loss of availability when there are unexpected issues. When this - timeout expires, processing of the upgrade domain will proceed regardless of availability loss - issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 - and 42949672925 inclusive. (unsigned 32-bit integer). - :vartype upgrade_replica_set_check_timeout: int - :ivar recreate_application: Determines whether the application should be recreated on update. - If value=true, the rest of the upgrade policy parameters are not allowed. - :vartype recreate_application: bool - """ - - _attribute_map = { - "application_health_policy": {"key": "applicationHealthPolicy", "type": "ApplicationHealthPolicy"}, - "force_restart": {"key": "forceRestart", "type": "bool"}, - "rolling_upgrade_monitoring_policy": { - "key": "rollingUpgradeMonitoringPolicy", - "type": "RollingUpgradeMonitoringPolicy", - }, - "instance_close_delay_duration": {"key": "instanceCloseDelayDuration", "type": "int"}, - "upgrade_mode": {"key": "upgradeMode", "type": "str"}, - "upgrade_replica_set_check_timeout": {"key": "upgradeReplicaSetCheckTimeout", "type": "int"}, - "recreate_application": {"key": "recreateApplication", "type": "bool"}, - } - - def __init__( - self, - *, - application_health_policy: Optional["_models.ApplicationHealthPolicy"] = None, - force_restart: bool = False, - rolling_upgrade_monitoring_policy: Optional["_models.RollingUpgradeMonitoringPolicy"] = None, - instance_close_delay_duration: Optional[int] = None, - upgrade_mode: Optional[Union[str, "_models.RollingUpgradeMode"]] = None, - upgrade_replica_set_check_timeout: Optional[int] = None, - recreate_application: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword application_health_policy: Defines a health policy used to evaluate the health of an - application or one of its children entities. - :paramtype application_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationHealthPolicy - :keyword force_restart: If true, then processes are forcefully restarted during upgrade even - when the code version has not changed (the upgrade only changes configuration or data). - :paramtype force_restart: bool - :keyword rolling_upgrade_monitoring_policy: The policy used for monitoring the application - upgrade. - :paramtype rolling_upgrade_monitoring_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMonitoringPolicy - :keyword instance_close_delay_duration: Duration in seconds, to wait before a stateless - instance is closed, to allow the active requests to drain gracefully. This would be effective - when the instance is closing during the application/cluster upgrade, only for those instances - which have a non-zero delay duration configured in the service description. - :paramtype instance_close_delay_duration: int - :keyword upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - Monitored, and UnmonitoredAuto. Known values are: "Monitored" and "UnmonitoredAuto". - :paramtype upgrade_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.RollingUpgradeMode - :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of - an upgrade domain and prevent loss of availability when there are unexpected issues. When this - timeout expires, processing of the upgrade domain will proceed regardless of availability loss - issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 - and 42949672925 inclusive. (unsigned 32-bit integer). - :paramtype upgrade_replica_set_check_timeout: int - :keyword recreate_application: Determines whether the application should be recreated on - update. If value=true, the rest of the upgrade policy parameters are not allowed. - :paramtype recreate_application: bool - """ - super().__init__(**kwargs) - self.application_health_policy = application_health_policy - self.force_restart = force_restart - self.rolling_upgrade_monitoring_policy = rolling_upgrade_monitoring_policy - self.instance_close_delay_duration = instance_close_delay_duration - self.upgrade_mode = upgrade_mode - self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout - self.recreate_application = recreate_application - - -class ApplicationUserAssignedIdentity(_serialization.Model): - """ApplicationUserAssignedIdentity. - - All required parameters must be populated in order to send to server. - - :ivar name: The friendly name of user assigned identity. Required. - :vartype name: str - :ivar principal_id: The principal id of user assigned identity. Required. - :vartype principal_id: str - """ - - _validation = { - "name": {"required": True}, - "principal_id": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "principal_id": {"key": "principalId", "type": "str"}, - } - - def __init__(self, *, name: str, principal_id: str, **kwargs: Any) -> None: - """ - :keyword name: The friendly name of user assigned identity. Required. - :paramtype name: str - :keyword principal_id: The principal id of user assigned identity. Required. - :paramtype principal_id: str - """ - super().__init__(**kwargs) - self.name = name - self.principal_id = principal_id - - -class AvailableOperationDisplay(_serialization.Model): - """Operation supported by the Service Fabric resource provider. - - :ivar provider: The name of the provider. - :vartype provider: str - :ivar resource: The resource on which the operation is performed. - :vartype resource: str - :ivar operation: The operation that can be performed. - :vartype operation: str - :ivar description: Operation description. - :vartype description: str - """ - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__( - self, - *, - provider: Optional[str] = None, - resource: Optional[str] = None, - operation: Optional[str] = None, - description: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword provider: The name of the provider. - :paramtype provider: str - :keyword resource: The resource on which the operation is performed. - :paramtype resource: str - :keyword operation: The operation that can be performed. - :paramtype operation: str - :keyword description: Operation description. - :paramtype description: str - """ - super().__init__(**kwargs) - self.provider = provider - self.resource = resource - self.operation = operation - self.description = description - - -class ScalingTrigger(_serialization.Model): - """Describes the trigger for performing a scaling operation. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - AveragePartitionLoadScalingTrigger, AverageServiceLoadScalingTrigger - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the trigger associated with this scaling policy. Required. Known values - are: "AveragePartitionLoadTrigger" and "AverageServiceLoadTrigger". - :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind - """ - - _validation = { - "kind": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - } - - _subtype_map = { - "kind": { - "AveragePartitionLoadTrigger": "AveragePartitionLoadScalingTrigger", - "AverageServiceLoadTrigger": "AverageServiceLoadScalingTrigger", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kind: Optional[str] = None - - -class AveragePartitionLoadScalingTrigger(ScalingTrigger): - """Represents a scaling trigger related to an average load of a metric/resource of a partition. - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the trigger associated with this scaling policy. Required. Known values - are: "AveragePartitionLoadTrigger" and "AverageServiceLoadTrigger". - :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind - :ivar metric_name: The name of the metric for which usage should be tracked. Required. - :vartype metric_name: str - :ivar lower_load_threshold: The lower limit of the load below which a scale in operation should - be performed. Required. - :vartype lower_load_threshold: float - :ivar upper_load_threshold: The upper limit of the load beyond which a scale out operation - should be performed. Required. - :vartype upper_load_threshold: float - :ivar scale_interval: The period in seconds on which a decision is made whether to scale or - not. This property should come in ISO 8601 format "hh:mm:ss". Required. - :vartype scale_interval: str - """ - - _validation = { - "kind": {"required": True}, - "metric_name": {"required": True}, - "lower_load_threshold": {"required": True}, - "upper_load_threshold": {"required": True}, - "scale_interval": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "lower_load_threshold": {"key": "lowerLoadThreshold", "type": "float"}, - "upper_load_threshold": {"key": "upperLoadThreshold", "type": "float"}, - "scale_interval": {"key": "scaleInterval", "type": "str"}, - } - - def __init__( - self, - *, - metric_name: str, - lower_load_threshold: float, - upper_load_threshold: float, - scale_interval: str, - **kwargs: Any - ) -> None: - """ - :keyword metric_name: The name of the metric for which usage should be tracked. Required. - :paramtype metric_name: str - :keyword lower_load_threshold: The lower limit of the load below which a scale in operation - should be performed. Required. - :paramtype lower_load_threshold: float - :keyword upper_load_threshold: The upper limit of the load beyond which a scale out operation - should be performed. Required. - :paramtype upper_load_threshold: float - :keyword scale_interval: The period in seconds on which a decision is made whether to scale or - not. This property should come in ISO 8601 format "hh:mm:ss". Required. - :paramtype scale_interval: str - """ - super().__init__(**kwargs) - self.kind: str = "AveragePartitionLoadTrigger" - self.metric_name = metric_name - self.lower_load_threshold = lower_load_threshold - self.upper_load_threshold = upper_load_threshold - self.scale_interval = scale_interval - - -class AverageServiceLoadScalingTrigger(ScalingTrigger): - """Represents a scaling policy related to an average load of a metric/resource of a service. - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the trigger associated with this scaling policy. Required. Known values - are: "AveragePartitionLoadTrigger" and "AverageServiceLoadTrigger". - :vartype kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingTriggerKind - :ivar metric_name: The name of the metric for which usage should be tracked. Required. - :vartype metric_name: str - :ivar lower_load_threshold: The lower limit of the load below which a scale in operation should - be performed. Required. - :vartype lower_load_threshold: float - :ivar upper_load_threshold: The upper limit of the load beyond which a scale out operation - should be performed. Required. - :vartype upper_load_threshold: float - :ivar scale_interval: The period in seconds on which a decision is made whether to scale or - not. This property should come in ISO 8601 format "hh:mm:ss". Required. - :vartype scale_interval: str - :ivar use_only_primary_load: Flag determines whether only the load of primary replica should be - considered for scaling. If set to true, then trigger will only consider the load of primary - replicas of stateful service. If set to false, trigger will consider load of all replicas. This - parameter cannot be set to true for stateless service. Required. - :vartype use_only_primary_load: bool - """ - - _validation = { - "kind": {"required": True}, - "metric_name": {"required": True}, - "lower_load_threshold": {"required": True}, - "upper_load_threshold": {"required": True}, - "scale_interval": {"required": True}, - "use_only_primary_load": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "metric_name": {"key": "metricName", "type": "str"}, - "lower_load_threshold": {"key": "lowerLoadThreshold", "type": "float"}, - "upper_load_threshold": {"key": "upperLoadThreshold", "type": "float"}, - "scale_interval": {"key": "scaleInterval", "type": "str"}, - "use_only_primary_load": {"key": "useOnlyPrimaryLoad", "type": "bool"}, - } - - def __init__( - self, - *, - metric_name: str, - lower_load_threshold: float, - upper_load_threshold: float, - scale_interval: str, - use_only_primary_load: bool, - **kwargs: Any - ) -> None: - """ - :keyword metric_name: The name of the metric for which usage should be tracked. Required. - :paramtype metric_name: str - :keyword lower_load_threshold: The lower limit of the load below which a scale in operation - should be performed. Required. - :paramtype lower_load_threshold: float - :keyword upper_load_threshold: The upper limit of the load beyond which a scale out operation - should be performed. Required. - :paramtype upper_load_threshold: float - :keyword scale_interval: The period in seconds on which a decision is made whether to scale or - not. This property should come in ISO 8601 format "hh:mm:ss". Required. - :paramtype scale_interval: str - :keyword use_only_primary_load: Flag determines whether only the load of primary replica should - be considered for scaling. If set to true, then trigger will only consider the load of primary - replicas of stateful service. If set to false, trigger will consider load of all replicas. This - parameter cannot be set to true for stateless service. Required. - :paramtype use_only_primary_load: bool - """ - super().__init__(**kwargs) - self.kind: str = "AverageServiceLoadTrigger" - self.metric_name = metric_name - self.lower_load_threshold = lower_load_threshold - self.upper_load_threshold = upper_load_threshold - self.scale_interval = scale_interval - self.use_only_primary_load = use_only_primary_load - - -class AzureActiveDirectory(_serialization.Model): - """The settings to enable AAD authentication on the cluster. - - :ivar tenant_id: Azure active directory tenant id. - :vartype tenant_id: str - :ivar cluster_application: Azure active directory cluster application id. - :vartype cluster_application: str - :ivar client_application: Azure active directory client application id. - :vartype client_application: str - """ - - _attribute_map = { - "tenant_id": {"key": "tenantId", "type": "str"}, - "cluster_application": {"key": "clusterApplication", "type": "str"}, - "client_application": {"key": "clientApplication", "type": "str"}, - } - - def __init__( - self, - *, - tenant_id: Optional[str] = None, - cluster_application: Optional[str] = None, - client_application: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword tenant_id: Azure active directory tenant id. - :paramtype tenant_id: str - :keyword cluster_application: Azure active directory cluster application id. - :paramtype cluster_application: str - :keyword client_application: Azure active directory client application id. - :paramtype client_application: str - """ - super().__init__(**kwargs) - self.tenant_id = tenant_id - self.cluster_application = cluster_application - self.client_application = client_application - - -class ClientCertificate(_serialization.Model): - """Client certificate definition. - - All required parameters must be populated in order to send to server. - - :ivar is_admin: Indicates if the client certificate has admin access to the cluster. Non admin - clients can perform only read only operations on the cluster. Required. - :vartype is_admin: bool - :ivar thumbprint: Certificate thumbprint. - :vartype thumbprint: str - :ivar common_name: Certificate common name. - :vartype common_name: str - :ivar issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with - CommonName. - :vartype issuer_thumbprint: str - """ - - _validation = { - "is_admin": {"required": True}, - } - - _attribute_map = { - "is_admin": {"key": "isAdmin", "type": "bool"}, - "thumbprint": {"key": "thumbprint", "type": "str"}, - "common_name": {"key": "commonName", "type": "str"}, - "issuer_thumbprint": {"key": "issuerThumbprint", "type": "str"}, - } - - def __init__( - self, - *, - is_admin: bool, - thumbprint: Optional[str] = None, - common_name: Optional[str] = None, - issuer_thumbprint: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword is_admin: Indicates if the client certificate has admin access to the cluster. Non - admin clients can perform only read only operations on the cluster. Required. - :paramtype is_admin: bool - :keyword thumbprint: Certificate thumbprint. - :paramtype thumbprint: str - :keyword common_name: Certificate common name. - :paramtype common_name: str - :keyword issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with - CommonName. - :paramtype issuer_thumbprint: str - """ - super().__init__(**kwargs) - self.is_admin = is_admin - self.thumbprint = thumbprint - self.common_name = common_name - self.issuer_thumbprint = issuer_thumbprint - - -class ClusterHealthPolicy(_serialization.Model): - """Defines a health policy used to evaluate the health of the cluster or of a cluster node. - - All required parameters must be populated in order to send to server. - - :ivar max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before - reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of nodes that can be unhealthy - before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy node, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy nodes over the total number - of nodes in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - - In large clusters, some nodes will always be down or out for repairs, so this percentage - should be configured to tolerate that. Required. - :vartype max_percent_unhealthy_nodes: int - :ivar max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy - applications before reporting an error. For example, to allow 10% of applications to be - unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of applications that can be - unhealthy before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy application, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy applications over the total number of - application instances in the cluster, excluding applications of application types that are - included in the ApplicationTypeHealthPolicyMap. - The computation rounds up to tolerate one failure on small numbers of applications. Default - percentage is zero. Required. - :vartype max_percent_unhealthy_applications: int - """ - - _validation = { - "max_percent_unhealthy_nodes": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_unhealthy_applications": {"required": True, "maximum": 100, "minimum": 0}, - } - - _attribute_map = { - "max_percent_unhealthy_nodes": {"key": "maxPercentUnhealthyNodes", "type": "int"}, - "max_percent_unhealthy_applications": {"key": "maxPercentUnhealthyApplications", "type": "int"}, - } - - def __init__( - self, *, max_percent_unhealthy_nodes: int = 0, max_percent_unhealthy_applications: int = 0, **kwargs: Any - ) -> None: - """ - :keyword max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before - reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of nodes that can be unhealthy - before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy node, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy nodes over the total number - of nodes in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - - In large clusters, some nodes will always be down or out for repairs, so this percentage - should be configured to tolerate that. Required. - :paramtype max_percent_unhealthy_nodes: int - :keyword max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy - applications before reporting an error. For example, to allow 10% of applications to be - unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of applications that can be - unhealthy before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy application, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy applications over the total number of - application instances in the cluster, excluding applications of application types that are - included in the ApplicationTypeHealthPolicyMap. - The computation rounds up to tolerate one failure on small numbers of applications. Default - percentage is zero. Required. - :paramtype max_percent_unhealthy_applications: int - """ - super().__init__(**kwargs) - self.max_percent_unhealthy_nodes = max_percent_unhealthy_nodes - self.max_percent_unhealthy_applications = max_percent_unhealthy_applications - - -class ClusterMonitoringPolicy(_serialization.Model): - """Describes the monitoring policies for the cluster upgrade. - - All required parameters must be populated in order to send to server. - - :ivar health_check_wait_duration: The length of time to wait after completing an upgrade domain - before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms - format. Required. - :vartype health_check_wait_duration: str - :ivar health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in - either hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :vartype health_check_stable_duration: str - :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either - hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :vartype health_check_retry_timeout: str - :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before the - upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :vartype upgrade_timeout: str - :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before the - upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :vartype upgrade_domain_timeout: str - """ - - _validation = { - "health_check_wait_duration": {"required": True}, - "health_check_stable_duration": {"required": True}, - "health_check_retry_timeout": {"required": True}, - "upgrade_timeout": {"required": True}, - "upgrade_domain_timeout": {"required": True}, - } - - _attribute_map = { - "health_check_wait_duration": {"key": "healthCheckWaitDuration", "type": "str"}, - "health_check_stable_duration": {"key": "healthCheckStableDuration", "type": "str"}, - "health_check_retry_timeout": {"key": "healthCheckRetryTimeout", "type": "str"}, - "upgrade_timeout": {"key": "upgradeTimeout", "type": "str"}, - "upgrade_domain_timeout": {"key": "upgradeDomainTimeout", "type": "str"}, - } - - def __init__( - self, - *, - health_check_wait_duration: str, - health_check_stable_duration: str, - health_check_retry_timeout: str, - upgrade_timeout: str, - upgrade_domain_timeout: str, - **kwargs: Any - ) -> None: - """ - :keyword health_check_wait_duration: The length of time to wait after completing an upgrade - domain before performing health checks. The duration can be in either hh:mm:ss or in - d.hh:mm:ss.ms format. Required. - :paramtype health_check_wait_duration: str - :keyword health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in - either hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :paramtype health_check_stable_duration: str - :keyword health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either - hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :paramtype health_check_retry_timeout: str - :keyword upgrade_timeout: The amount of time the overall upgrade has to complete before the - upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. Required. - :paramtype upgrade_timeout: str - :keyword upgrade_domain_timeout: The amount of time each upgrade domain has to complete before - the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - Required. - :paramtype upgrade_domain_timeout: str - """ - super().__init__(**kwargs) - self.health_check_wait_duration = health_check_wait_duration - self.health_check_stable_duration = health_check_stable_duration - self.health_check_retry_timeout = health_check_retry_timeout - self.upgrade_timeout = upgrade_timeout - self.upgrade_domain_timeout = upgrade_domain_timeout - - -class ClusterUpgradeDeltaHealthPolicy(_serialization.Model): - """Describes the delta health policies for the cluster upgrade. - - All required parameters must be populated in order to send to server. - - :ivar max_percent_delta_unhealthy_nodes: The maximum allowed percentage of nodes health - degradation allowed during cluster upgrades. - The delta is measured between the state of the nodes at the beginning of upgrade and the state - of the nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. Required. - :vartype max_percent_delta_unhealthy_nodes: int - :ivar max_percent_upgrade_domain_delta_unhealthy_nodes: The maximum allowed percentage of - upgrade domain nodes health degradation allowed during cluster upgrades. - The delta is measured between the state of the upgrade domain nodes at the beginning of - upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion for all completed upgrade - domains to make sure the state of the upgrade domains is within tolerated limits. - :vartype max_percent_upgrade_domain_delta_unhealthy_nodes: int - :ivar max_percent_delta_unhealthy_applications: The maximum allowed percentage of applications - health degradation allowed during cluster upgrades. - The delta is measured between the state of the applications at the beginning of upgrade and - the state of the applications at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. System services are not included in this. - NOTE: This value will overwrite the value specified in - properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications. - :vartype max_percent_delta_unhealthy_applications: int - """ - - _validation = { - "max_percent_delta_unhealthy_nodes": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_upgrade_domain_delta_unhealthy_nodes": {"maximum": 100, "minimum": 0}, - "max_percent_delta_unhealthy_applications": {"maximum": 100, "minimum": 0}, - } - - _attribute_map = { - "max_percent_delta_unhealthy_nodes": {"key": "maxPercentDeltaUnhealthyNodes", "type": "int"}, - "max_percent_upgrade_domain_delta_unhealthy_nodes": { - "key": "maxPercentUpgradeDomainDeltaUnhealthyNodes", - "type": "int", - }, - "max_percent_delta_unhealthy_applications": {"key": "maxPercentDeltaUnhealthyApplications", "type": "int"}, - } - - def __init__( - self, - *, - max_percent_delta_unhealthy_nodes: int, - max_percent_upgrade_domain_delta_unhealthy_nodes: Optional[int] = None, - max_percent_delta_unhealthy_applications: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword max_percent_delta_unhealthy_nodes: The maximum allowed percentage of nodes health - degradation allowed during cluster upgrades. - The delta is measured between the state of the nodes at the beginning of upgrade and the state - of the nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. Required. - :paramtype max_percent_delta_unhealthy_nodes: int - :keyword max_percent_upgrade_domain_delta_unhealthy_nodes: The maximum allowed percentage of - upgrade domain nodes health degradation allowed during cluster upgrades. - The delta is measured between the state of the upgrade domain nodes at the beginning of - upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion for all completed upgrade - domains to make sure the state of the upgrade domains is within tolerated limits. - :paramtype max_percent_upgrade_domain_delta_unhealthy_nodes: int - :keyword max_percent_delta_unhealthy_applications: The maximum allowed percentage of - applications health degradation allowed during cluster upgrades. - The delta is measured between the state of the applications at the beginning of upgrade and - the state of the applications at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. System services are not included in this. - NOTE: This value will overwrite the value specified in - properties.UpgradeDescription.HealthPolicy.MaxPercentUnhealthyApplications. - :paramtype max_percent_delta_unhealthy_applications: int - """ - super().__init__(**kwargs) - self.max_percent_delta_unhealthy_nodes = max_percent_delta_unhealthy_nodes - self.max_percent_upgrade_domain_delta_unhealthy_nodes = max_percent_upgrade_domain_delta_unhealthy_nodes - self.max_percent_delta_unhealthy_applications = max_percent_delta_unhealthy_applications - - -class ClusterUpgradePolicy(_serialization.Model): - """Describes the policy used when upgrading the cluster. - - :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :vartype force_restart: bool - :ivar health_policy: The cluster health policy defines a health policy used to evaluate the - health of the cluster during a cluster upgrade. - :vartype health_policy: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy - :ivar delta_health_policy: The cluster delta health policy defines a health policy used to - evaluate the health of the cluster during a cluster upgrade. - :vartype delta_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy - :ivar monitoring_policy: The cluster monitoring policy describes the parameters for monitoring - an upgrade in Monitored mode. - :vartype monitoring_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy - :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an - upgrade domain and prevent loss of availability when there are unexpected issues. - When this timeout expires, processing of the upgrade domain will proceed regardless of - availability loss issues. - The timeout is reset at the start of each upgrade domain. The timeout can be in either - hh:mm:ss or in d.hh:mm:ss.ms format. - This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds). - :vartype upgrade_replica_set_check_timeout: str - """ - - _attribute_map = { - "force_restart": {"key": "forceRestart", "type": "bool"}, - "health_policy": {"key": "healthPolicy", "type": "ClusterHealthPolicy"}, - "delta_health_policy": {"key": "deltaHealthPolicy", "type": "ClusterUpgradeDeltaHealthPolicy"}, - "monitoring_policy": {"key": "monitoringPolicy", "type": "ClusterMonitoringPolicy"}, - "upgrade_replica_set_check_timeout": {"key": "upgradeReplicaSetCheckTimeout", "type": "str"}, - } - - def __init__( - self, - *, - force_restart: Optional[bool] = None, - health_policy: Optional["_models.ClusterHealthPolicy"] = None, - delta_health_policy: Optional["_models.ClusterUpgradeDeltaHealthPolicy"] = None, - monitoring_policy: Optional["_models.ClusterMonitoringPolicy"] = None, - upgrade_replica_set_check_timeout: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword force_restart: If true, then processes are forcefully restarted during upgrade even - when the code version has not changed (the upgrade only changes configuration or data). - :paramtype force_restart: bool - :keyword health_policy: The cluster health policy defines a health policy used to evaluate the - health of the cluster during a cluster upgrade. - :paramtype health_policy: ~azure.mgmt.servicefabricmanagedclusters.models.ClusterHealthPolicy - :keyword delta_health_policy: The cluster delta health policy defines a health policy used to - evaluate the health of the cluster during a cluster upgrade. - :paramtype delta_health_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeDeltaHealthPolicy - :keyword monitoring_policy: The cluster monitoring policy describes the parameters for - monitoring an upgrade in Monitored mode. - :paramtype monitoring_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterMonitoringPolicy - :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of - an upgrade domain and prevent loss of availability when there are unexpected issues. - When this timeout expires, processing of the upgrade domain will proceed regardless of - availability loss issues. - The timeout is reset at the start of each upgrade domain. The timeout can be in either - hh:mm:ss or in d.hh:mm:ss.ms format. - This value must be between 00:00:00 and 49710.06:28:15 (unsigned 32 bit integer for seconds). - :paramtype upgrade_replica_set_check_timeout: str - """ - super().__init__(**kwargs) - self.force_restart = force_restart - self.health_policy = health_policy - self.delta_health_policy = delta_health_policy - self.monitoring_policy = monitoring_policy - self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout - - -class EndpointRangeDescription(_serialization.Model): - """Port range details. - - All required parameters must be populated in order to send to server. - - :ivar start_port: Starting port of a range of ports. Required. - :vartype start_port: int - :ivar end_port: End port of a range of ports. Required. - :vartype end_port: int - """ - - _validation = { - "start_port": {"required": True}, - "end_port": {"required": True}, - } - - _attribute_map = { - "start_port": {"key": "startPort", "type": "int"}, - "end_port": {"key": "endPort", "type": "int"}, - } - - def __init__(self, *, start_port: int, end_port: int, **kwargs: Any) -> None: - """ - :keyword start_port: Starting port of a range of ports. Required. - :paramtype start_port: int - :keyword end_port: End port of a range of ports. Required. - :paramtype end_port: int - """ - super().__init__(**kwargs) - self.start_port = start_port - self.end_port = end_port - - -class ErrorModel(_serialization.Model): - """The structure of the error. - - :ivar error: The error details. - :vartype error: ~azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorModelError"}, - } - - def __init__(self, *, error: Optional["_models.ErrorModelError"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error details. - :paramtype error: ~azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError - """ - super().__init__(**kwargs) - self.error = error - - -class ErrorModelError(_serialization.Model): - """The error details. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - """ - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, *, code: Optional[str] = None, message: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword code: The error code. - :paramtype code: str - :keyword message: The error message. - :paramtype message: str - """ - super().__init__(**kwargs) - self.code = code - self.message = message - - -class FrontendConfiguration(_serialization.Model): - """Describes the frontend configurations for the node type. - - :ivar ip_address_type: The IP address type of this frontend configuration. If omitted the - default value is IPv4. Known values are: "IPv4" and "IPv6". - :vartype ip_address_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.IPAddressType - :ivar load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend - address pool that the VM instances of the node type are associated with. The format of the - resource Id is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/backendAddressPools/:code:``'. # pylint: disable=line-too-long - :vartype load_balancer_backend_address_pool_id: str - :ivar load_balancer_inbound_nat_pool_id: The resource Id of the Load Balancer inbound NAT pool - that the VM instances of the node type are associated with. The format of the resource Id is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/inboundNatPools/:code:``'. # pylint: disable=line-too-long - :vartype load_balancer_inbound_nat_pool_id: str - :ivar application_gateway_backend_address_pool_id: The resource Id of application gateway - backend address pool. The format of the resource Id is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/applicationGateways/:code:``/backendAddressPools/:code:``'. # pylint: disable=line-too-long - :vartype application_gateway_backend_address_pool_id: str - """ - - _attribute_map = { - "ip_address_type": {"key": "ipAddressType", "type": "str"}, - "load_balancer_backend_address_pool_id": {"key": "loadBalancerBackendAddressPoolId", "type": "str"}, - "load_balancer_inbound_nat_pool_id": {"key": "loadBalancerInboundNatPoolId", "type": "str"}, - "application_gateway_backend_address_pool_id": {"key": "applicationGatewayBackendAddressPoolId", "type": "str"}, - } - - def __init__( - self, - *, - ip_address_type: Union[str, "_models.IPAddressType"] = "IPv4", - load_balancer_backend_address_pool_id: Optional[str] = None, - load_balancer_inbound_nat_pool_id: Optional[str] = None, - application_gateway_backend_address_pool_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword ip_address_type: The IP address type of this frontend configuration. If omitted the - default value is IPv4. Known values are: "IPv4" and "IPv6". - :paramtype ip_address_type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.IPAddressType - :keyword load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend - address pool that the VM instances of the node type are associated with. The format of the - resource Id is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/backendAddressPools/:code:``'. # pylint: disable=line-too-long - :paramtype load_balancer_backend_address_pool_id: str - :keyword load_balancer_inbound_nat_pool_id: The resource Id of the Load Balancer inbound NAT - pool that the VM instances of the node type are associated with. The format of the resource Id - is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/inboundNatPools/:code:``'. # pylint: disable=line-too-long - :paramtype load_balancer_inbound_nat_pool_id: str - :keyword application_gateway_backend_address_pool_id: The resource Id of application gateway - backend address pool. The format of the resource Id is - '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/applicationGateways/:code:``/backendAddressPools/:code:``'. # pylint: disable=line-too-long - :paramtype application_gateway_backend_address_pool_id: str - """ - super().__init__(**kwargs) - self.ip_address_type = ip_address_type - self.load_balancer_backend_address_pool_id = load_balancer_backend_address_pool_id - self.load_balancer_inbound_nat_pool_id = load_balancer_inbound_nat_pool_id - self.application_gateway_backend_address_pool_id = application_gateway_backend_address_pool_id - - -class IpConfiguration(_serialization.Model): - """Specifies an IP configuration of the network interface. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the network interface. Required. - :vartype name: str - :ivar application_gateway_backend_address_pools: Specifies an array of references to backend - address pools of application gateways. A node type can reference backend address pools of - multiple application gateways. Multiple node types cannot use the same application gateway. - :vartype application_gateway_backend_address_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :ivar load_balancer_backend_address_pools: Specifies an array of references to backend address - pools of load balancers. A node type can reference backend address pools of one public and one - internal load balancer. Multiple node types cannot use the same basic sku load balancer. - :vartype load_balancer_backend_address_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :ivar load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools of - the load balancers. A node type can reference inbound nat pools of one public and one internal - load balancer. Multiple node types cannot use the same basic sku load balancer. - :vartype load_balancer_inbound_nat_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :ivar subnet: Specifies the subnet of the network interface. - :vartype subnet: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :ivar private_ip_address_version: Specifies whether the IP configuration's private IP is IPv4 - or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". - :vartype private_ip_address_version: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion - :ivar public_ip_address_configuration: The public IP address configuration of the network - interface. - :vartype public_ip_address_configuration: - ~azure.mgmt.servicefabricmanagedclusters.models.IpConfigurationPublicIPAddressConfiguration - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "application_gateway_backend_address_pools": { - "key": "applicationGatewayBackendAddressPools", - "type": "[SubResource]", - }, - "load_balancer_backend_address_pools": {"key": "loadBalancerBackendAddressPools", "type": "[SubResource]"}, - "load_balancer_inbound_nat_pools": {"key": "loadBalancerInboundNatPools", "type": "[SubResource]"}, - "subnet": {"key": "subnet", "type": "SubResource"}, - "private_ip_address_version": {"key": "privateIPAddressVersion", "type": "str"}, - "public_ip_address_configuration": { - "key": "publicIPAddressConfiguration", - "type": "IpConfigurationPublicIPAddressConfiguration", - }, - } - - def __init__( - self, - *, - name: str, - application_gateway_backend_address_pools: Optional[List["_models.SubResource"]] = None, - load_balancer_backend_address_pools: Optional[List["_models.SubResource"]] = None, - load_balancer_inbound_nat_pools: Optional[List["_models.SubResource"]] = None, - subnet: Optional["_models.SubResource"] = None, - private_ip_address_version: Union[str, "_models.PrivateIPAddressVersion"] = "IPv4", - public_ip_address_configuration: Optional["_models.IpConfigurationPublicIPAddressConfiguration"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the network interface. Required. - :paramtype name: str - :keyword application_gateway_backend_address_pools: Specifies an array of references to backend - address pools of application gateways. A node type can reference backend address pools of - multiple application gateways. Multiple node types cannot use the same application gateway. - :paramtype application_gateway_backend_address_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :keyword load_balancer_backend_address_pools: Specifies an array of references to backend - address pools of load balancers. A node type can reference backend address pools of one public - and one internal load balancer. Multiple node types cannot use the same basic sku load - balancer. - :paramtype load_balancer_backend_address_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :keyword load_balancer_inbound_nat_pools: Specifies an array of references to inbound Nat pools - of the load balancers. A node type can reference inbound nat pools of one public and one - internal load balancer. Multiple node types cannot use the same basic sku load balancer. - :paramtype load_balancer_inbound_nat_pools: - list[~azure.mgmt.servicefabricmanagedclusters.models.SubResource] - :keyword subnet: Specifies the subnet of the network interface. - :paramtype subnet: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :keyword private_ip_address_version: Specifies whether the IP configuration's private IP is - IPv4 or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". - :paramtype private_ip_address_version: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateIPAddressVersion - :keyword public_ip_address_configuration: The public IP address configuration of the network - interface. - :paramtype public_ip_address_configuration: - ~azure.mgmt.servicefabricmanagedclusters.models.IpConfigurationPublicIPAddressConfiguration - """ - super().__init__(**kwargs) - self.name = name - self.application_gateway_backend_address_pools = application_gateway_backend_address_pools - self.load_balancer_backend_address_pools = load_balancer_backend_address_pools - self.load_balancer_inbound_nat_pools = load_balancer_inbound_nat_pools - self.subnet = subnet - self.private_ip_address_version = private_ip_address_version - self.public_ip_address_configuration = public_ip_address_configuration - - -class IpConfigurationPublicIPAddressConfiguration(_serialization.Model): # pylint: disable=name-too-long - """The public IP address configuration of the network interface. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the network interface. Required. - :vartype name: str - :ivar ip_tags: Specifies the list of IP tags associated with the public IP address. - :vartype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] - :ivar public_ip_address_version: Specifies whether the IP configuration's public IP is IPv4 or - IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". - :vartype public_ip_address_version: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "ip_tags": {"key": "ipTags", "type": "[IpTag]"}, - "public_ip_address_version": {"key": "publicIPAddressVersion", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - ip_tags: Optional[List["_models.IpTag"]] = None, - public_ip_address_version: Union[str, "_models.PublicIPAddressVersion"] = "IPv4", - **kwargs: Any - ) -> None: - """ - :keyword name: Name of the network interface. Required. - :paramtype name: str - :keyword ip_tags: Specifies the list of IP tags associated with the public IP address. - :paramtype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] - :keyword public_ip_address_version: Specifies whether the IP configuration's public IP is IPv4 - or IPv6. Default is IPv4. Known values are: "IPv4" and "IPv6". - :paramtype public_ip_address_version: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PublicIPAddressVersion - """ - super().__init__(**kwargs) - self.name = name - self.ip_tags = ip_tags - self.public_ip_address_version = public_ip_address_version - - -class IpTag(_serialization.Model): - """The IP tag associated with the public IP address. - - All required parameters must be populated in order to send to server. - - :ivar ip_tag_type: IP tag type. Example: FirstPartyUsage. Required. - :vartype ip_tag_type: str - :ivar tag: IP tag associated with the public IP. Example: SQL, Storage etc. Required. - :vartype tag: str - """ - - _validation = { - "ip_tag_type": {"required": True}, - "tag": {"required": True}, - } - - _attribute_map = { - "ip_tag_type": {"key": "ipTagType", "type": "str"}, - "tag": {"key": "tag", "type": "str"}, - } - - def __init__(self, *, ip_tag_type: str, tag: str, **kwargs: Any) -> None: - """ - :keyword ip_tag_type: IP tag type. Example: FirstPartyUsage. Required. - :paramtype ip_tag_type: str - :keyword tag: IP tag associated with the public IP. Example: SQL, Storage etc. Required. - :paramtype tag: str - """ - super().__init__(**kwargs) - self.ip_tag_type = ip_tag_type - self.tag = tag - - -class LoadBalancingRule(_serialization.Model): - """Describes a load balancing rule. - - All required parameters must be populated in order to send to server. - - :ivar frontend_port: The port for the external endpoint. Port numbers for each rule must be - unique within the Load Balancer. Acceptable values are between 1 and 65534. Required. - :vartype frontend_port: int - :ivar backend_port: The port used for internal connections on the endpoint. Acceptable values - are between 1 and 65535. Required. - :vartype backend_port: int - :ivar protocol: The reference to the transport protocol used by the load balancing rule. - Required. Known values are: "tcp" and "udp". - :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.Protocol - :ivar probe_port: The prob port used by the load balancing rule. Acceptable values are between - 1 and 65535. - :vartype probe_port: int - :ivar probe_protocol: the reference to the load balancer probe used by the load balancing rule. - Required. Known values are: "tcp", "http", and "https". - :vartype probe_protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol - :ivar probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. - :vartype probe_request_path: str - :ivar load_distribution: The load distribution policy for this rule. - :vartype load_distribution: str - """ - - _validation = { - "frontend_port": {"required": True, "maximum": 65534, "minimum": 1}, - "backend_port": {"required": True, "maximum": 65534, "minimum": 1}, - "protocol": {"required": True}, - "probe_port": {"maximum": 65534, "minimum": 1}, - "probe_protocol": {"required": True}, - } - - _attribute_map = { - "frontend_port": {"key": "frontendPort", "type": "int"}, - "backend_port": {"key": "backendPort", "type": "int"}, - "protocol": {"key": "protocol", "type": "str"}, - "probe_port": {"key": "probePort", "type": "int"}, - "probe_protocol": {"key": "probeProtocol", "type": "str"}, - "probe_request_path": {"key": "probeRequestPath", "type": "str"}, - "load_distribution": {"key": "loadDistribution", "type": "str"}, - } - - def __init__( - self, - *, - frontend_port: int, - backend_port: int, - protocol: Union[str, "_models.Protocol"], - probe_protocol: Union[str, "_models.ProbeProtocol"], - probe_port: Optional[int] = None, - probe_request_path: Optional[str] = None, - load_distribution: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword frontend_port: The port for the external endpoint. Port numbers for each rule must be - unique within the Load Balancer. Acceptable values are between 1 and 65534. Required. - :paramtype frontend_port: int - :keyword backend_port: The port used for internal connections on the endpoint. Acceptable - values are between 1 and 65535. Required. - :paramtype backend_port: int - :keyword protocol: The reference to the transport protocol used by the load balancing rule. - Required. Known values are: "tcp" and "udp". - :paramtype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.Protocol - :keyword probe_port: The prob port used by the load balancing rule. Acceptable values are - between 1 and 65535. - :paramtype probe_port: int - :keyword probe_protocol: the reference to the load balancer probe used by the load balancing - rule. Required. Known values are: "tcp", "http", and "https". - :paramtype probe_protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.ProbeProtocol - :keyword probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. - :paramtype probe_request_path: str - :keyword load_distribution: The load distribution policy for this rule. - :paramtype load_distribution: str - """ - super().__init__(**kwargs) - self.frontend_port = frontend_port - self.backend_port = backend_port - self.protocol = protocol - self.probe_port = probe_port - self.probe_protocol = probe_protocol - self.probe_request_path = probe_request_path - self.load_distribution = load_distribution - - -class LongRunningOperationResult(_serialization.Model): - """Long running operation result. - - :ivar name: The name of the operation. - :vartype name: str - :ivar start_time: The start time of the operation. - :vartype start_time: ~datetime.datetime - :ivar end_time: The end time of the operation. - :vartype end_time: ~datetime.datetime - :ivar percent_complete: The completion percentage of the operation. - :vartype percent_complete: float - :ivar status: The status of the operation. - :vartype status: str - :ivar error: The operation error. - :vartype error: ~azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "start_time": {"key": "startTime", "type": "iso-8601"}, - "end_time": {"key": "endTime", "type": "iso-8601"}, - "percent_complete": {"key": "percentComplete", "type": "float"}, - "status": {"key": "status", "type": "str"}, - "error": {"key": "error", "type": "ErrorModelError"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - start_time: Optional[datetime.datetime] = None, - end_time: Optional[datetime.datetime] = None, - percent_complete: Optional[float] = None, - status: Optional[str] = None, - error: Optional["_models.ErrorModelError"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the operation. - :paramtype name: str - :keyword start_time: The start time of the operation. - :paramtype start_time: ~datetime.datetime - :keyword end_time: The end time of the operation. - :paramtype end_time: ~datetime.datetime - :keyword percent_complete: The completion percentage of the operation. - :paramtype percent_complete: float - :keyword status: The status of the operation. - :paramtype status: str - :keyword error: The operation error. - :paramtype error: ~azure.mgmt.servicefabricmanagedclusters.models.ErrorModelError - """ - super().__init__(**kwargs) - self.name = name - self.start_time = start_time - self.end_time = end_time - self.percent_complete = percent_complete - self.status = status - self.error = error - - -class ManagedAzResiliencyStatus(_serialization.Model): - """Describes the result of the request to list Managed VM Sizes for Service Fabric Managed - Clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar base_resource_status: List of Managed VM Sizes for Service Fabric Managed Clusters. - :vartype base_resource_status: - list[~azure.mgmt.servicefabricmanagedclusters.models.ResourceAzStatus] - :ivar is_cluster_zone_resilient: URL to get the next set of Managed VM Sizes if there are any. - :vartype is_cluster_zone_resilient: bool - """ - - _validation = { - "is_cluster_zone_resilient": {"readonly": True}, - } - - _attribute_map = { - "base_resource_status": {"key": "baseResourceStatus", "type": "[ResourceAzStatus]"}, - "is_cluster_zone_resilient": {"key": "isClusterZoneResilient", "type": "bool"}, - } - - def __init__( - self, *, base_resource_status: Optional[List["_models.ResourceAzStatus"]] = None, **kwargs: Any - ) -> None: - """ - :keyword base_resource_status: List of Managed VM Sizes for Service Fabric Managed Clusters. - :paramtype base_resource_status: - list[~azure.mgmt.servicefabricmanagedclusters.models.ResourceAzStatus] - """ - super().__init__(**kwargs) - self.base_resource_status = base_resource_status - self.is_cluster_zone_resilient = None - - -class Resource(_serialization.Model): - """The resource model 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 identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Azure resource location. Required. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": 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}"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword location: Azure resource location. Required. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.etag = None - self.system_data = None - - -class ManagedCluster(Resource): - """The managed cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Azure resource location. Required. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar sku: The sku of the managed cluster. Required. - :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.Sku - :ivar dns_name: The cluster dns name. - :vartype dns_name: str - :ivar fqdn: The fully qualified domain name associated with the public load balancer of the - cluster. - :vartype fqdn: str - :ivar ipv4_address: The IPv4 address associated with the public load balancer of the cluster. - :vartype ipv4_address: str - :ivar cluster_id: A service generated unique identifier for the cluster resource. - :vartype cluster_id: str - :ivar cluster_state: The current state of the cluster. Known values are: "WaitingForNodes", - "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", and "Ready". - :vartype cluster_state: str or ~azure.mgmt.servicefabricmanagedclusters.models.ClusterState - :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. - :vartype cluster_certificate_thumbprints: list[str] - :ivar client_connection_port: The port used for client connections to the cluster. - :vartype client_connection_port: int - :ivar http_gateway_connection_port: The port used for HTTP connections to the cluster. - :vartype http_gateway_connection_port: int - :ivar admin_user_name: VM admin user name. - :vartype admin_user_name: str - :ivar admin_password: VM admin user password. - :vartype admin_password: str - :ivar load_balancing_rules: Load balancing rules that are applied to the public load balancer - of the cluster. - :vartype load_balancing_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.LoadBalancingRule] - :ivar allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG rule - opens RDP port to Internet which can be overridden with custom Network Security Rules. The - default value for this setting is false. - :vartype allow_rdp_access: bool - :ivar network_security_rules: Custom Network Security Rules that are applied to the Virtual - Network of the cluster. - :vartype network_security_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] - :ivar clients: Client certificates that are allowed to manage the cluster. - :vartype clients: list[~azure.mgmt.servicefabricmanagedclusters.models.ClientCertificate] - :ivar azure_active_directory: The AAD authentication settings of the cluster. - :vartype azure_active_directory: - ~azure.mgmt.servicefabricmanagedclusters.models.AzureActiveDirectory - :ivar fabric_settings: The list of custom fabric settings to configure the cluster. - :vartype fabric_settings: - list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsSectionDescription] - :ivar provisioning_state: The provisioning state of the managed cluster resource. Known values - are: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", - "Deleted", and "Other". - :vartype provisioning_state: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState - :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property is - required when **clusterUpgradeMode** is set to 'Manual'. To get list of available Service - Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the - list of available version for existing clusters use **availableClusterVersions**. - :vartype cluster_code_version: str - :ivar cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime - version is available. Known values are: "Automatic" and "Manual". - :vartype cluster_upgrade_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode - :ivar cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be - applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** - is set to 'Automatic'. Known values are: "Wave0", "Wave1", and "Wave2". - :vartype cluster_upgrade_cadence: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence - :ivar addon_features: List of add-on features to enable on the cluster. - :vartype addon_features: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterAddOnFeature] - :ivar enable_auto_os_upgrade: Enables automatic OS upgrade for node types created using OS - images with version 'latest'. The default value for this setting is false. - :vartype enable_auto_os_upgrade: bool - :ivar zonal_resiliency: Indicates if the cluster has zone resiliency. - :vartype zonal_resiliency: bool - :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :vartype application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionsCleanupPolicy - :ivar enable_ipv6: Setting this to true creates IPv6 address space for the default VNet used by - the cluster. This setting cannot be changed once the cluster is created. The default value for - this setting is false. - :vartype enable_ipv6: bool - :ivar subnet_id: If specified, the node types for the cluster are created in this subnet - instead of the default VNet. The **networkSecurityRules** specified for the cluster are also - applied to this subnet. This setting cannot be changed once the cluster is created. - :vartype subnet_id: str - :ivar ip_tags: The list of IP tags associated with the default public IP address of the - cluster. - :vartype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] - :ivar ipv6_address: IPv6 address for the cluster if IPv6 is enabled. - :vartype ipv6_address: str - :ivar enable_service_public_ip: Setting this to true will link the IPv4 address as the - ServicePublicIP of the IPv6 address. It can only be set to True if IPv6 is enabled on the - cluster. - :vartype enable_service_public_ip: bool - :ivar auxiliary_subnets: Auxiliary subnets for the cluster. - :vartype auxiliary_subnets: list[~azure.mgmt.servicefabricmanagedclusters.models.Subnet] - :ivar service_endpoints: Service endpoints for subnets in the cluster. - :vartype service_endpoints: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceEndpoint] - :ivar zonal_update_mode: Indicates the update mode for Cross Az clusters. Known values are: - "Standard" and "Fast". - :vartype zonal_update_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ZonalUpdateMode - :ivar use_custom_vnet: For new clusters, this parameter indicates that it uses Bring your own - VNet, but the subnet is specified at node type level; and for such clusters, the subnetId - property is required for node types. - :vartype use_custom_vnet: bool - :ivar public_ip_prefix_id: Specify the resource id of a public IPv4 prefix that the load - balancer will allocate a public IPv4 address from. This setting cannot be changed once the - cluster is created. - :vartype public_ip_prefix_id: str - :ivar public_i_pv6_prefix_id: Specify the resource id of a public IPv6 prefix that the load - balancer will allocate a public IPv6 address from. This setting cannot be changed once the - cluster is created. - :vartype public_i_pv6_prefix_id: str - :ivar ddos_protection_plan_id: Specify the resource id of a DDoS network protection plan that - will be associated with the virtual network of the cluster. - :vartype ddos_protection_plan_id: str - :ivar upgrade_description: The policy to use when upgrading the cluster. - :vartype upgrade_description: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy - :ivar http_gateway_token_auth_connection_port: The port used for token-auth based HTTPS - connections to the cluster. Cannot be set to the same port as HttpGatewayEndpoint. - :vartype http_gateway_token_auth_connection_port: int - :ivar enable_http_gateway_exclusive_auth_mode: If true, token-based authentication is not - allowed on the HttpGatewayEndpoint. This is required to support TLS versions 1.3 and above. If - token-based authentication is used, HttpGatewayTokenAuthConnectionPort must be defined. - :vartype enable_http_gateway_exclusive_auth_mode: bool - :ivar auto_generated_domain_name_label_scope: This property is the entry point to using a - public CA cert for your cluster cert. It specifies the level of reuse allowed for the custom - FQDN created, matching the subject of the public CA cert. Known values are: "TenantReuse", - "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :vartype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.servicefabricmanagedclusters.models.AutoGeneratedDomainNameLabelScope - :ivar allocated_outbound_ports: The number of outbound ports allocated for SNAT for each node - in the backend pool of the default load balancer. The default value is 0 which provides dynamic - port allocation based on pool size. - :vartype allocated_outbound_ports: int - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "system_data": {"readonly": True}, - "sku": {"required": True}, - "fqdn": {"readonly": True}, - "ipv4_address": {"readonly": True}, - "cluster_id": {"readonly": True}, - "cluster_state": {"readonly": True}, - "cluster_certificate_thumbprints": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "ipv6_address": {"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}"}, - "etag": {"key": "etag", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "sku": {"key": "sku", "type": "Sku"}, - "dns_name": {"key": "properties.dnsName", "type": "str"}, - "fqdn": {"key": "properties.fqdn", "type": "str"}, - "ipv4_address": {"key": "properties.ipv4Address", "type": "str"}, - "cluster_id": {"key": "properties.clusterId", "type": "str"}, - "cluster_state": {"key": "properties.clusterState", "type": "str"}, - "cluster_certificate_thumbprints": {"key": "properties.clusterCertificateThumbprints", "type": "[str]"}, - "client_connection_port": {"key": "properties.clientConnectionPort", "type": "int"}, - "http_gateway_connection_port": {"key": "properties.httpGatewayConnectionPort", "type": "int"}, - "admin_user_name": {"key": "properties.adminUserName", "type": "str"}, - "admin_password": {"key": "properties.adminPassword", "type": "str"}, - "load_balancing_rules": {"key": "properties.loadBalancingRules", "type": "[LoadBalancingRule]"}, - "allow_rdp_access": {"key": "properties.allowRdpAccess", "type": "bool"}, - "network_security_rules": {"key": "properties.networkSecurityRules", "type": "[NetworkSecurityRule]"}, - "clients": {"key": "properties.clients", "type": "[ClientCertificate]"}, - "azure_active_directory": {"key": "properties.azureActiveDirectory", "type": "AzureActiveDirectory"}, - "fabric_settings": {"key": "properties.fabricSettings", "type": "[SettingsSectionDescription]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "cluster_code_version": {"key": "properties.clusterCodeVersion", "type": "str"}, - "cluster_upgrade_mode": {"key": "properties.clusterUpgradeMode", "type": "str"}, - "cluster_upgrade_cadence": {"key": "properties.clusterUpgradeCadence", "type": "str"}, - "addon_features": {"key": "properties.addonFeatures", "type": "[str]"}, - "enable_auto_os_upgrade": {"key": "properties.enableAutoOSUpgrade", "type": "bool"}, - "zonal_resiliency": {"key": "properties.zonalResiliency", "type": "bool"}, - "application_type_versions_cleanup_policy": { - "key": "properties.applicationTypeVersionsCleanupPolicy", - "type": "ApplicationTypeVersionsCleanupPolicy", - }, - "enable_ipv6": {"key": "properties.enableIpv6", "type": "bool"}, - "subnet_id": {"key": "properties.subnetId", "type": "str"}, - "ip_tags": {"key": "properties.ipTags", "type": "[IpTag]"}, - "ipv6_address": {"key": "properties.ipv6Address", "type": "str"}, - "enable_service_public_ip": {"key": "properties.enableServicePublicIP", "type": "bool"}, - "auxiliary_subnets": {"key": "properties.auxiliarySubnets", "type": "[Subnet]"}, - "service_endpoints": {"key": "properties.serviceEndpoints", "type": "[ServiceEndpoint]"}, - "zonal_update_mode": {"key": "properties.zonalUpdateMode", "type": "str"}, - "use_custom_vnet": {"key": "properties.useCustomVnet", "type": "bool"}, - "public_ip_prefix_id": {"key": "properties.publicIPPrefixId", "type": "str"}, - "public_i_pv6_prefix_id": {"key": "properties.publicIPv6PrefixId", "type": "str"}, - "ddos_protection_plan_id": {"key": "properties.ddosProtectionPlanId", "type": "str"}, - "upgrade_description": {"key": "properties.upgradeDescription", "type": "ClusterUpgradePolicy"}, - "http_gateway_token_auth_connection_port": { - "key": "properties.httpGatewayTokenAuthConnectionPort", - "type": "int", - }, - "enable_http_gateway_exclusive_auth_mode": { - "key": "properties.enableHttpGatewayExclusiveAuthMode", - "type": "bool", - }, - "auto_generated_domain_name_label_scope": { - "key": "properties.autoGeneratedDomainNameLabelScope", - "type": "str", - }, - "allocated_outbound_ports": {"key": "properties.allocatedOutboundPorts", "type": "int"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - location: str, - sku: "_models.Sku", - tags: Optional[Dict[str, str]] = None, - dns_name: Optional[str] = None, - client_connection_port: int = 19000, - http_gateway_connection_port: int = 19080, - admin_user_name: Optional[str] = None, - admin_password: Optional[str] = None, - load_balancing_rules: Optional[List["_models.LoadBalancingRule"]] = None, - allow_rdp_access: Optional[bool] = None, - network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, - clients: Optional[List["_models.ClientCertificate"]] = None, - azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, - fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = None, - cluster_code_version: Optional[str] = None, - cluster_upgrade_mode: Union[str, "_models.ClusterUpgradeMode"] = "Automatic", - cluster_upgrade_cadence: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = None, - addon_features: Optional[List[Union[str, "_models.ManagedClusterAddOnFeature"]]] = None, - enable_auto_os_upgrade: Optional[bool] = None, - zonal_resiliency: bool = False, - application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = None, - enable_ipv6: Optional[bool] = None, - subnet_id: Optional[str] = None, - ip_tags: Optional[List["_models.IpTag"]] = None, - enable_service_public_ip: Optional[bool] = None, - auxiliary_subnets: Optional[List["_models.Subnet"]] = None, - service_endpoints: Optional[List["_models.ServiceEndpoint"]] = None, - zonal_update_mode: Optional[Union[str, "_models.ZonalUpdateMode"]] = None, - use_custom_vnet: Optional[bool] = None, - public_ip_prefix_id: Optional[str] = None, - public_i_pv6_prefix_id: Optional[str] = None, - ddos_protection_plan_id: Optional[str] = None, - upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, - http_gateway_token_auth_connection_port: Optional[int] = None, - enable_http_gateway_exclusive_auth_mode: Optional[bool] = None, - auto_generated_domain_name_label_scope: Optional[ - Union[str, "_models.AutoGeneratedDomainNameLabelScope"] - ] = None, - allocated_outbound_ports: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Azure resource location. Required. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - :keyword sku: The sku of the managed cluster. Required. - :paramtype sku: ~azure.mgmt.servicefabricmanagedclusters.models.Sku - :keyword dns_name: The cluster dns name. - :paramtype dns_name: str - :keyword client_connection_port: The port used for client connections to the cluster. - :paramtype client_connection_port: int - :keyword http_gateway_connection_port: The port used for HTTP connections to the cluster. - :paramtype http_gateway_connection_port: int - :keyword admin_user_name: VM admin user name. - :paramtype admin_user_name: str - :keyword admin_password: VM admin user password. - :paramtype admin_password: str - :keyword load_balancing_rules: Load balancing rules that are applied to the public load - balancer of the cluster. - :paramtype load_balancing_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.LoadBalancingRule] - :keyword allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG - rule opens RDP port to Internet which can be overridden with custom Network Security Rules. The - default value for this setting is false. - :paramtype allow_rdp_access: bool - :keyword network_security_rules: Custom Network Security Rules that are applied to the Virtual - Network of the cluster. - :paramtype network_security_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] - :keyword clients: Client certificates that are allowed to manage the cluster. - :paramtype clients: list[~azure.mgmt.servicefabricmanagedclusters.models.ClientCertificate] - :keyword azure_active_directory: The AAD authentication settings of the cluster. - :paramtype azure_active_directory: - ~azure.mgmt.servicefabricmanagedclusters.models.AzureActiveDirectory - :keyword fabric_settings: The list of custom fabric settings to configure the cluster. - :paramtype fabric_settings: - list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsSectionDescription] - :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property - is required when **clusterUpgradeMode** is set to 'Manual'. To get list of available Service - Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the - list of available version for existing clusters use **availableClusterVersions**. - :paramtype cluster_code_version: str - :keyword cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime - version is available. Known values are: "Automatic" and "Manual". - :paramtype cluster_upgrade_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeMode - :keyword cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be - applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** - is set to 'Automatic'. Known values are: "Wave0", "Wave1", and "Wave2". - :paramtype cluster_upgrade_cadence: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradeCadence - :keyword addon_features: List of add-on features to enable on the cluster. - :paramtype addon_features: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterAddOnFeature] - :keyword enable_auto_os_upgrade: Enables automatic OS upgrade for node types created using OS - images with version 'latest'. The default value for this setting is false. - :paramtype enable_auto_os_upgrade: bool - :keyword zonal_resiliency: Indicates if the cluster has zone resiliency. - :paramtype zonal_resiliency: bool - :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :paramtype application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionsCleanupPolicy - :keyword enable_ipv6: Setting this to true creates IPv6 address space for the default VNet used - by the cluster. This setting cannot be changed once the cluster is created. The default value - for this setting is false. - :paramtype enable_ipv6: bool - :keyword subnet_id: If specified, the node types for the cluster are created in this subnet - instead of the default VNet. The **networkSecurityRules** specified for the cluster are also - applied to this subnet. This setting cannot be changed once the cluster is created. - :paramtype subnet_id: str - :keyword ip_tags: The list of IP tags associated with the default public IP address of the - cluster. - :paramtype ip_tags: list[~azure.mgmt.servicefabricmanagedclusters.models.IpTag] - :keyword enable_service_public_ip: Setting this to true will link the IPv4 address as the - ServicePublicIP of the IPv6 address. It can only be set to True if IPv6 is enabled on the - cluster. - :paramtype enable_service_public_ip: bool - :keyword auxiliary_subnets: Auxiliary subnets for the cluster. - :paramtype auxiliary_subnets: list[~azure.mgmt.servicefabricmanagedclusters.models.Subnet] - :keyword service_endpoints: Service endpoints for subnets in the cluster. - :paramtype service_endpoints: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceEndpoint] - :keyword zonal_update_mode: Indicates the update mode for Cross Az clusters. Known values are: - "Standard" and "Fast". - :paramtype zonal_update_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ZonalUpdateMode - :keyword use_custom_vnet: For new clusters, this parameter indicates that it uses Bring your - own VNet, but the subnet is specified at node type level; and for such clusters, the subnetId - property is required for node types. - :paramtype use_custom_vnet: bool - :keyword public_ip_prefix_id: Specify the resource id of a public IPv4 prefix that the load - balancer will allocate a public IPv4 address from. This setting cannot be changed once the - cluster is created. - :paramtype public_ip_prefix_id: str - :keyword public_i_pv6_prefix_id: Specify the resource id of a public IPv6 prefix that the load - balancer will allocate a public IPv6 address from. This setting cannot be changed once the - cluster is created. - :paramtype public_i_pv6_prefix_id: str - :keyword ddos_protection_plan_id: Specify the resource id of a DDoS network protection plan - that will be associated with the virtual network of the cluster. - :paramtype ddos_protection_plan_id: str - :keyword upgrade_description: The policy to use when upgrading the cluster. - :paramtype upgrade_description: - ~azure.mgmt.servicefabricmanagedclusters.models.ClusterUpgradePolicy - :keyword http_gateway_token_auth_connection_port: The port used for token-auth based HTTPS - connections to the cluster. Cannot be set to the same port as HttpGatewayEndpoint. - :paramtype http_gateway_token_auth_connection_port: int - :keyword enable_http_gateway_exclusive_auth_mode: If true, token-based authentication is not - allowed on the HttpGatewayEndpoint. This is required to support TLS versions 1.3 and above. If - token-based authentication is used, HttpGatewayTokenAuthConnectionPort must be defined. - :paramtype enable_http_gateway_exclusive_auth_mode: bool - :keyword auto_generated_domain_name_label_scope: This property is the entry point to using a - public CA cert for your cluster cert. It specifies the level of reuse allowed for the custom - FQDN created, matching the subject of the public CA cert. Known values are: "TenantReuse", - "SubscriptionReuse", "ResourceGroupReuse", and "NoReuse". - :paramtype auto_generated_domain_name_label_scope: str or - ~azure.mgmt.servicefabricmanagedclusters.models.AutoGeneratedDomainNameLabelScope - :keyword allocated_outbound_ports: The number of outbound ports allocated for SNAT for each - node in the backend pool of the default load balancer. The default value is 0 which provides - dynamic port allocation based on pool size. - :paramtype allocated_outbound_ports: int - """ - super().__init__(location=location, tags=tags, **kwargs) - self.sku = sku - self.dns_name = dns_name - self.fqdn = None - self.ipv4_address = None - self.cluster_id = None - self.cluster_state = None - self.cluster_certificate_thumbprints = None - self.client_connection_port = client_connection_port - self.http_gateway_connection_port = http_gateway_connection_port - self.admin_user_name = admin_user_name - self.admin_password = admin_password - self.load_balancing_rules = load_balancing_rules - self.allow_rdp_access = allow_rdp_access - self.network_security_rules = network_security_rules - self.clients = clients - self.azure_active_directory = azure_active_directory - self.fabric_settings = fabric_settings - self.provisioning_state = None - self.cluster_code_version = cluster_code_version - self.cluster_upgrade_mode = cluster_upgrade_mode - self.cluster_upgrade_cadence = cluster_upgrade_cadence - self.addon_features = addon_features - self.enable_auto_os_upgrade = enable_auto_os_upgrade - self.zonal_resiliency = zonal_resiliency - self.application_type_versions_cleanup_policy = application_type_versions_cleanup_policy - self.enable_ipv6 = enable_ipv6 - self.subnet_id = subnet_id - self.ip_tags = ip_tags - self.ipv6_address = None - self.enable_service_public_ip = enable_service_public_ip - self.auxiliary_subnets = auxiliary_subnets - self.service_endpoints = service_endpoints - self.zonal_update_mode = zonal_update_mode - self.use_custom_vnet = use_custom_vnet - self.public_ip_prefix_id = public_ip_prefix_id - self.public_i_pv6_prefix_id = public_i_pv6_prefix_id - self.ddos_protection_plan_id = ddos_protection_plan_id - self.upgrade_description = upgrade_description - self.http_gateway_token_auth_connection_port = http_gateway_token_auth_connection_port - self.enable_http_gateway_exclusive_auth_mode = enable_http_gateway_exclusive_auth_mode - self.auto_generated_domain_name_label_scope = auto_generated_domain_name_label_scope - self.allocated_outbound_ports = allocated_outbound_ports - - -class ManagedClusterCodeVersionResult(_serialization.Model): - """The result of the Service Fabric runtime versions. - - :ivar id: The identification of the result. - :vartype id: str - :ivar name: The name of the result. - :vartype name: str - :ivar type: The result resource type. - :vartype type: str - :ivar cluster_code_version: The Service Fabric runtime version of the cluster. - :vartype cluster_code_version: str - :ivar support_expiry_utc: The date of expiry of support of the version. - :vartype support_expiry_utc: str - :ivar os_type: Cluster operating system, the default will be Windows. "Windows" - :vartype os_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.OsType - """ - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "cluster_code_version": {"key": "properties.clusterCodeVersion", "type": "str"}, - "support_expiry_utc": {"key": "properties.supportExpiryUtc", "type": "str"}, - "os_type": {"key": "properties.osType", "type": "str"}, - } - - def __init__( - self, - *, - id: Optional[str] = None, # pylint: disable=redefined-builtin - name: Optional[str] = None, - type: Optional[str] = None, - cluster_code_version: Optional[str] = None, - support_expiry_utc: Optional[str] = None, - os_type: Optional[Union[str, "_models.OsType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword id: The identification of the result. - :paramtype id: str - :keyword name: The name of the result. - :paramtype name: str - :keyword type: The result resource type. - :paramtype type: str - :keyword cluster_code_version: The Service Fabric runtime version of the cluster. - :paramtype cluster_code_version: str - :keyword support_expiry_utc: The date of expiry of support of the version. - :paramtype support_expiry_utc: str - :keyword os_type: Cluster operating system, the default will be Windows. "Windows" - :paramtype os_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.OsType - """ - super().__init__(**kwargs) - self.id = id - self.name = name - self.type = type - self.cluster_code_version = cluster_code_version - self.support_expiry_utc = support_expiry_utc - self.os_type = os_type - - -class ManagedClusterListResult(_serialization.Model): - """Managed Cluster list results. - - :ivar value: - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ManagedCluster]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.ManagedCluster"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedClusterUpdateParameters(_serialization.Model): - """Managed cluster update request. - - :ivar tags: Managed cluster update parameters. - :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: Managed cluster update parameters. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ManagedIdentity(_serialization.Model): - """Describes the managed identities for an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the managed identity. This property will only be - provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for - a system assigned identity. - :vartype tenant_id: str - :ivar type: The type of managed identity for the resource. Known values are: "None", - "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :vartype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType - :ivar user_assigned_identities: The list of user identities associated with the resource. The - user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.servicefabricmanagedclusters.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The type of managed identity for the resource. Known values are: "None", - "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :paramtype type: str or ~azure.mgmt.servicefabricmanagedclusters.models.ManagedIdentityType - :keyword user_assigned_identities: The list of user identities associated with the resource. - The user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.servicefabricmanagedclusters.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class ManagedMaintenanceWindowStatus(_serialization.Model): - """Describes the maintenance window status of the Service Fabric Managed Cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar is_window_enabled: If maintenance window is enabled on this cluster. - :vartype is_window_enabled: bool - :ivar is_region_ready: Indicates if the region is ready to configure maintenance windows. - :vartype is_region_ready: bool - :ivar is_window_active: If maintenance window is active. - :vartype is_window_active: bool - :ivar can_apply_updates: If updates can be applied. - :vartype can_apply_updates: bool - :ivar last_window_status_update_at_utc: Last window update time in UTC. - :vartype last_window_status_update_at_utc: ~datetime.datetime - :ivar last_window_start_time_utc: Last window start time in UTC. - :vartype last_window_start_time_utc: ~datetime.datetime - :ivar last_window_end_time_utc: Last window end time in UTC. - :vartype last_window_end_time_utc: ~datetime.datetime - """ - - _validation = { - "is_window_enabled": {"readonly": True}, - "is_region_ready": {"readonly": True}, - "is_window_active": {"readonly": True}, - "can_apply_updates": {"readonly": True}, - "last_window_status_update_at_utc": {"readonly": True}, - "last_window_start_time_utc": {"readonly": True}, - "last_window_end_time_utc": {"readonly": True}, - } - - _attribute_map = { - "is_window_enabled": {"key": "isWindowEnabled", "type": "bool"}, - "is_region_ready": {"key": "isRegionReady", "type": "bool"}, - "is_window_active": {"key": "isWindowActive", "type": "bool"}, - "can_apply_updates": {"key": "canApplyUpdates", "type": "bool"}, - "last_window_status_update_at_utc": {"key": "lastWindowStatusUpdateAtUTC", "type": "iso-8601"}, - "last_window_start_time_utc": {"key": "lastWindowStartTimeUTC", "type": "iso-8601"}, - "last_window_end_time_utc": {"key": "lastWindowEndTimeUTC", "type": "iso-8601"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.is_window_enabled = None - self.is_region_ready = None - self.is_window_active = None - self.can_apply_updates = None - self.last_window_status_update_at_utc = None - self.last_window_start_time_utc = None - self.last_window_end_time_utc = None - - -class ManagedProxyResource(_serialization.Model): - """The resource model definition for proxy-only resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.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"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.tags = tags - self.system_data = None - - -class ManagedVMSize(_serialization.Model): - """Describes a VM Sizes. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar properties: VM Size properties. - :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.VMSize - :ivar id: VM Size id. - :vartype id: str - :ivar name: VM Size name. - :vartype name: str - :ivar type: VM Size type. - :vartype type: str - """ - - _validation = { - "properties": {"readonly": True}, - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - } - - _attribute_map = { - "properties": {"key": "properties", "type": "VMSize"}, - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.properties = None - self.id = None - self.name = None - self.type = None - - -class ManagedVMSizesResult(_serialization.Model): - """Describes the result of the request to list Managed VM Sizes for Service Fabric Managed - Clusters. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Managed VM Sizes for Service Fabric Managed Clusters. - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] - :ivar next_link: URL to get the next set of Managed VM Sizes if there are any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ManagedVMSize]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ManagedVMSize"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of Managed VM Sizes for Service Fabric Managed Clusters. - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class Partition(_serialization.Model): - """Describes how the service is partitioned. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - NamedPartitionScheme, SingletonPartitionScheme, UniformInt64RangePartitionScheme - - All required parameters must be populated in order to send to server. - - :ivar partition_scheme: Specifies how the service is partitioned. Required. Known values are: - "Singleton", "UniformInt64Range", and "Named". - :vartype partition_scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme - """ - - _validation = { - "partition_scheme": {"required": True}, - } - - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - } - - _subtype_map = { - "partition_scheme": { - "Named": "NamedPartitionScheme", - "Singleton": "SingletonPartitionScheme", - "UniformInt64Range": "UniformInt64RangePartitionScheme", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.partition_scheme: Optional[str] = None - - -class NamedPartitionScheme(Partition): - """Describes the named partition scheme of the service. - - All required parameters must be populated in order to send to server. - - :ivar partition_scheme: Specifies how the service is partitioned. Required. Known values are: - "Singleton", "UniformInt64Range", and "Named". - :vartype partition_scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme - :ivar names: Array for the names of the partitions. Required. - :vartype names: list[str] - """ - - _validation = { - "partition_scheme": {"required": True}, - "names": {"required": True}, - } - - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - "names": {"key": "names", "type": "[str]"}, - } - - def __init__(self, *, names: List[str], **kwargs: Any) -> None: - """ - :keyword names: Array for the names of the partitions. Required. - :paramtype names: list[str] - """ - super().__init__(**kwargs) - self.partition_scheme: str = "Named" - self.names = names - - -class NetworkSecurityRule(_serialization.Model): - """Describes a network security rule. - - All required parameters must be populated in order to send to server. - - :ivar name: Network security rule name. Required. - :vartype name: str - :ivar description: Network security rule description. - :vartype description: str - :ivar protocol: Network protocol this rule applies to. Required. Known values are: "http", - "https", "tcp", "udp", "icmp", "ah", and "esp". - :vartype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol - :ivar source_address_prefixes: The CIDR or source IP ranges. - :vartype source_address_prefixes: list[str] - :ivar destination_address_prefixes: The destination address prefixes. CIDR or destination IP - ranges. - :vartype destination_address_prefixes: list[str] - :ivar source_port_ranges: The source port ranges. - :vartype source_port_ranges: list[str] - :ivar destination_port_ranges: The destination port ranges. - :vartype destination_port_ranges: list[str] - :ivar source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to - match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' - can also be used. If this is an ingress rule, specifies where network traffic originates from. - :vartype source_address_prefix: str - :ivar destination_address_prefix: The destination address prefix. CIDR or destination IP range. - Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', - 'AzureLoadBalancer' and 'Internet' can also be used. - :vartype destination_address_prefix: str - :ivar source_port_range: The source port or range. Integer or range between 0 and 65535. - Asterisk '*' can also be used to match all ports. - :vartype source_port_range: str - :ivar destination_port_range: he destination port or range. Integer or range between 0 and - 65535. Asterisk '*' can also be used to match all ports. - :vartype destination_port_range: str - :ivar access: The network traffic is allowed or denied. Required. Known values are: "allow" and - "deny". - :vartype access: str or ~azure.mgmt.servicefabricmanagedclusters.models.Access - :ivar priority: The priority of the rule. The value can be in the range 1000 to 3000. Values - outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The - priority number must be unique for each rule in the collection. The lower the priority number, - the higher the priority of the rule. Required. - :vartype priority: int - :ivar direction: Network security rule direction. Required. Known values are: "inbound" and - "outbound". - :vartype direction: str or ~azure.mgmt.servicefabricmanagedclusters.models.Direction - """ - - _validation = { - "name": {"required": True}, - "protocol": {"required": True}, - "access": {"required": True}, - "priority": {"required": True, "maximum": 3000, "minimum": 1000}, - "direction": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "description": {"key": "description", "type": "str"}, - "protocol": {"key": "protocol", "type": "str"}, - "source_address_prefixes": {"key": "sourceAddressPrefixes", "type": "[str]"}, - "destination_address_prefixes": {"key": "destinationAddressPrefixes", "type": "[str]"}, - "source_port_ranges": {"key": "sourcePortRanges", "type": "[str]"}, - "destination_port_ranges": {"key": "destinationPortRanges", "type": "[str]"}, - "source_address_prefix": {"key": "sourceAddressPrefix", "type": "str"}, - "destination_address_prefix": {"key": "destinationAddressPrefix", "type": "str"}, - "source_port_range": {"key": "sourcePortRange", "type": "str"}, - "destination_port_range": {"key": "destinationPortRange", "type": "str"}, - "access": {"key": "access", "type": "str"}, - "priority": {"key": "priority", "type": "int"}, - "direction": {"key": "direction", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - protocol: Union[str, "_models.NsgProtocol"], - access: Union[str, "_models.Access"], - priority: int, - direction: Union[str, "_models.Direction"], - description: Optional[str] = None, - source_address_prefixes: Optional[List[str]] = None, - destination_address_prefixes: Optional[List[str]] = None, - source_port_ranges: Optional[List[str]] = None, - destination_port_ranges: Optional[List[str]] = None, - source_address_prefix: Optional[str] = None, - destination_address_prefix: Optional[str] = None, - source_port_range: Optional[str] = None, - destination_port_range: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Network security rule name. Required. - :paramtype name: str - :keyword description: Network security rule description. - :paramtype description: str - :keyword protocol: Network protocol this rule applies to. Required. Known values are: "http", - "https", "tcp", "udp", "icmp", "ah", and "esp". - :paramtype protocol: str or ~azure.mgmt.servicefabricmanagedclusters.models.NsgProtocol - :keyword source_address_prefixes: The CIDR or source IP ranges. - :paramtype source_address_prefixes: list[str] - :keyword destination_address_prefixes: The destination address prefixes. CIDR or destination IP - ranges. - :paramtype destination_address_prefixes: list[str] - :keyword source_port_ranges: The source port ranges. - :paramtype source_port_ranges: list[str] - :keyword destination_port_ranges: The destination port ranges. - :paramtype destination_port_ranges: list[str] - :keyword source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to - match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' - can also be used. If this is an ingress rule, specifies where network traffic originates from. - :paramtype source_address_prefix: str - :keyword destination_address_prefix: The destination address prefix. CIDR or destination IP - range. Asterisk '*' can also be used to match all source IPs. Default tags such as - 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. - :paramtype destination_address_prefix: str - :keyword source_port_range: The source port or range. Integer or range between 0 and 65535. - Asterisk '*' can also be used to match all ports. - :paramtype source_port_range: str - :keyword destination_port_range: he destination port or range. Integer or range between 0 and - 65535. Asterisk '*' can also be used to match all ports. - :paramtype destination_port_range: str - :keyword access: The network traffic is allowed or denied. Required. Known values are: "allow" - and "deny". - :paramtype access: str or ~azure.mgmt.servicefabricmanagedclusters.models.Access - :keyword priority: The priority of the rule. The value can be in the range 1000 to 3000. Values - outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The - priority number must be unique for each rule in the collection. The lower the priority number, - the higher the priority of the rule. Required. - :paramtype priority: int - :keyword direction: Network security rule direction. Required. Known values are: "inbound" and - "outbound". - :paramtype direction: str or ~azure.mgmt.servicefabricmanagedclusters.models.Direction - """ - super().__init__(**kwargs) - self.name = name - self.description = description - self.protocol = protocol - self.source_address_prefixes = source_address_prefixes - self.destination_address_prefixes = destination_address_prefixes - self.source_port_ranges = source_port_ranges - self.destination_port_ranges = destination_port_ranges - self.source_address_prefix = source_address_prefix - self.destination_address_prefix = destination_address_prefix - self.source_port_range = source_port_range - self.destination_port_range = destination_port_range - self.access = access - self.priority = priority - self.direction = direction - - -class NodeType(ManagedProxyResource): - """Describes a node type in the cluster, each node type represents sub set of nodes in the - cluster. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar sku: The node type sku. - :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku - :ivar is_primary: Indicates the Service Fabric system services for the cluster will run on this - node type. This setting cannot be changed once the node type is created. - :vartype is_primary: bool - :ivar vm_instance_count: The number of nodes in the node type. :code:`
`:code:`
`\\ - **Values:** :code:`
`-1 - Use when auto scale rules are configured or sku.capacity is - defined :code:`
` 0 - Not supported :code:`
` >0 - Use for manual scale. - :vartype vm_instance_count: int - :ivar data_disk_size_gb: Disk size for the managed disk attached to the vms on the node type in - GBs. - :vartype data_disk_size_gb: int - :ivar data_disk_type: Managed data disk type. Specifies the storage account type for the - managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", and "Premium_LRS". - :vartype data_disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType - :ivar data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D and - it can not change after created. - :vartype data_disk_letter: str - :ivar placement_properties: The placement tags applied to nodes in the node type, which can be - used to indicate where certain services (workload) should run. - :vartype placement_properties: dict[str, str] - :ivar capacities: The capacity tags applied to the nodes in the node type, the cluster resource - manager uses these tags to understand how much resource a node has. - :vartype capacities: dict[str, str] - :ivar application_ports: The range of ports from which cluster assigned port to Service Fabric - applications. - :vartype application_ports: - ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription - :ivar ephemeral_ports: The range of ephemeral ports that nodes in this node type should be - configured with. - :vartype ephemeral_ports: - ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription - :ivar vm_size: The size of virtual machines in the pool. All virtual machines in a pool are the - same size. For example, Standard_D3. - :vartype vm_size: str - :ivar vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For - example, Canonical or MicrosoftWindowsServer. - :vartype vm_image_publisher: str - :ivar vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For - example, UbuntuServer or WindowsServer. - :vartype vm_image_offer: str - :ivar vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, - 14.04.0-LTS or 2012-R2-Datacenter. - :vartype vm_image_sku: str - :ivar vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value of - 'latest' can be specified to select the latest version of an image. If omitted, the default is - 'latest'. - :vartype vm_image_version: str - :ivar vm_secrets: The secrets to install in the virtual machines. - :vartype vm_secrets: list[~azure.mgmt.servicefabricmanagedclusters.models.VaultSecretGroup] - :ivar vm_extensions: Set of extensions that should be installed onto the virtual machines. - :vartype vm_extensions: list[~azure.mgmt.servicefabricmanagedclusters.models.VMSSExtension] - :ivar vm_managed_identity: Identities to assign to the virtual machine scale set under the node - type. - :vartype vm_managed_identity: ~azure.mgmt.servicefabricmanagedclusters.models.VmManagedIdentity - :ivar is_stateless: Indicates if the node type can only host Stateless workloads. - :vartype is_stateless: bool - :ivar multiple_placement_groups: Indicates if scale set associated with the node type can be - composed of multiple placement groups. - :vartype multiple_placement_groups: bool - :ivar frontend_configurations: Indicates the node type uses its own frontend configurations - instead of the default one for the cluster. This setting can only be specified for non-primary - node types and can not be added or removed after the node type is created. - :vartype frontend_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.FrontendConfiguration] - :ivar network_security_rules: The Network Security Rules for this node type. This setting can - only be specified for node types that are configured with frontend configurations. - :vartype network_security_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] - :ivar additional_data_disks: Additional managed data disks. - :vartype additional_data_disks: - list[~azure.mgmt.servicefabricmanagedclusters.models.VmssDataDisk] - :ivar enable_encryption_at_host: Enable or disable the Host Encryption for the virtual machines - on the node type. This will enable the encryption for all the disks including Resource/Temp - disk at host itself. Default: The Encryption at host will be disabled unless this property is - set to true for the resource. - :vartype enable_encryption_at_host: bool - :ivar provisioning_state: The provisioning state of the node type resource. Known values are: - "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", - "Deleted", and "Other". - :vartype provisioning_state: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedResourceProvisioningState - :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :vartype enable_accelerated_networking: bool - :ivar use_default_public_load_balancer: Specifies whether the use public load balancer. If not - specified and the node type doesn't have its own frontend configuration, it will be attached to - the default load balancer. If the node type uses its own Load balancer and - useDefaultPublicLoadBalancer is true, then the frontend has to be an Internal Load Balancer. If - the node type uses its own Load balancer and useDefaultPublicLoadBalancer is false or not set, - then the custom load balancer must include a public load balancer to provide outbound - connectivity. - :vartype use_default_public_load_balancer: bool - :ivar use_temp_data_disk: Specifies whether to use the temporary disk for the service fabric - data root, in which case no managed data disk will be attached and the temporary disk will be - used. It is only allowed for stateless node types. - :vartype use_temp_data_disk: bool - :ivar enable_over_provisioning: Specifies whether the node type should be overprovisioned. It - is only allowed for stateless node types. - :vartype enable_over_provisioning: bool - :ivar zones: Specifies the availability zones where the node type would span across. If the - cluster is not spanning across availability zones, initiates az migration for the cluster. - :vartype zones: list[str] - :ivar is_spot_vm: Indicates whether the node type will be Spot Virtual Machines. Azure will - allocate the VMs if there is capacity available and the VMs can be evicted at any time. - :vartype is_spot_vm: bool - :ivar host_group_id: Specifies the full host group resource Id. This property is used for - deploying on azure dedicated hosts. - :vartype host_group_id: str - :ivar use_ephemeral_os_disk: Indicates whether to use ephemeral os disk. The sku selected on - the vmSize property needs to support this feature. - :vartype use_ephemeral_os_disk: bool - :ivar spot_restore_timeout: Indicates the time duration after which the platform will not try - to restore the VMSS SPOT instances specified as ISO 8601. - :vartype spot_restore_timeout: str - :ivar eviction_policy: Specifies the eviction policy for virtual machines in a SPOT node type. - Default is Delete. Known values are: "Delete" and "Deallocate". - :vartype eviction_policy: str or - ~azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType - :ivar vm_image_resource_id: Indicates the resource id of the vm image. This parameter is used - for custom vm image. - :vartype vm_image_resource_id: str - :ivar subnet_id: Indicates the resource id of the subnet for the node type. - :vartype subnet_id: str - :ivar vm_setup_actions: Specifies the actions to be performed on the vms before bootstrapping - the service fabric runtime. - :vartype vm_setup_actions: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.VmSetupAction] - :ivar security_type: Specifies the security type of the nodeType. Only Standard and - TrustedLaunch are currently supported. Known values are: "TrustedLaunch" and "Standard". - :vartype security_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.SecurityType - :ivar secure_boot_enabled: Specifies whether secure boot should be enabled on the nodeType. Can - only be used with TrustedLaunch SecurityType. - :vartype secure_boot_enabled: bool - :ivar enable_node_public_ip: Specifies whether each node is allocated its own public IPv4 - address. This is only supported on secondary node types with custom Load Balancers. - :vartype enable_node_public_ip: bool - :ivar enable_node_public_i_pv6: Specifies whether each node is allocated its own public IPv6 - address. This is only supported on secondary node types with custom Load Balancers. - :vartype enable_node_public_i_pv6: bool - :ivar vm_shared_gallery_image_id: Indicates the resource id of the vm shared galleries image. - This parameter is used for custom vm image. - :vartype vm_shared_gallery_image_id: str - :ivar nat_gateway_id: Specifies the resource id of a NAT Gateway to attach to the subnet of - this node type. Node type must use custom load balancer. - :vartype nat_gateway_id: str - :ivar nat_configurations: Specifies the NAT configuration on default public Load Balancer for - the node type. This is only supported for node types use the default public Load Balancer. - :vartype nat_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeNatConfig] - :ivar vm_image_plan: Specifies information about the marketplace image used to create the - virtual machine. This element is only used for marketplace images. Before you can use a - marketplace image from an API, you must enable the image for programmatic use. In the Azure - portal, find the marketplace image that you want to use and then click Want to deploy - programmatically, Get Started ->. Enter any required information and then click Save. - :vartype vm_image_plan: ~azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan - :ivar service_artifact_reference_id: Specifies the service artifact reference id used to set - same image version for all virtual machines in the scale set when using 'latest' image version. - :vartype service_artifact_reference_id: str - :ivar dscp_configuration_id: Specifies the resource id of the DSCP configuration to apply to - the node type network interface. - :vartype dscp_configuration_id: str - :ivar additional_network_interface_configurations: Specifies the settings for any additional - secondary network interfaces to attach to the node type. - :vartype additional_network_interface_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration] - :ivar computer_name_prefix: Specifies the computer name prefix. Limited to 9 characters. If - specified, allows for a longer name to be specified for the node type name. - :vartype computer_name_prefix: str - :ivar vm_applications: Specifies the gallery applications that should be made available to the - underlying VMSS. - :vartype vm_applications: list[~azure.mgmt.servicefabricmanagedclusters.models.VmApplication] - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "vm_instance_count": {"maximum": 2147483647, "minimum": -1}, - "data_disk_letter": {"pattern": r"^[a-zA-Z]{1}$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "sku": {"key": "sku", "type": "NodeTypeSku"}, - "is_primary": {"key": "properties.isPrimary", "type": "bool"}, - "vm_instance_count": {"key": "properties.vmInstanceCount", "type": "int"}, - "data_disk_size_gb": {"key": "properties.dataDiskSizeGB", "type": "int"}, - "data_disk_type": {"key": "properties.dataDiskType", "type": "str"}, - "data_disk_letter": {"key": "properties.dataDiskLetter", "type": "str"}, - "placement_properties": {"key": "properties.placementProperties", "type": "{str}"}, - "capacities": {"key": "properties.capacities", "type": "{str}"}, - "application_ports": {"key": "properties.applicationPorts", "type": "EndpointRangeDescription"}, - "ephemeral_ports": {"key": "properties.ephemeralPorts", "type": "EndpointRangeDescription"}, - "vm_size": {"key": "properties.vmSize", "type": "str"}, - "vm_image_publisher": {"key": "properties.vmImagePublisher", "type": "str"}, - "vm_image_offer": {"key": "properties.vmImageOffer", "type": "str"}, - "vm_image_sku": {"key": "properties.vmImageSku", "type": "str"}, - "vm_image_version": {"key": "properties.vmImageVersion", "type": "str"}, - "vm_secrets": {"key": "properties.vmSecrets", "type": "[VaultSecretGroup]"}, - "vm_extensions": {"key": "properties.vmExtensions", "type": "[VMSSExtension]"}, - "vm_managed_identity": {"key": "properties.vmManagedIdentity", "type": "VmManagedIdentity"}, - "is_stateless": {"key": "properties.isStateless", "type": "bool"}, - "multiple_placement_groups": {"key": "properties.multiplePlacementGroups", "type": "bool"}, - "frontend_configurations": {"key": "properties.frontendConfigurations", "type": "[FrontendConfiguration]"}, - "network_security_rules": {"key": "properties.networkSecurityRules", "type": "[NetworkSecurityRule]"}, - "additional_data_disks": {"key": "properties.additionalDataDisks", "type": "[VmssDataDisk]"}, - "enable_encryption_at_host": {"key": "properties.enableEncryptionAtHost", "type": "bool"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "enable_accelerated_networking": {"key": "properties.enableAcceleratedNetworking", "type": "bool"}, - "use_default_public_load_balancer": {"key": "properties.useDefaultPublicLoadBalancer", "type": "bool"}, - "use_temp_data_disk": {"key": "properties.useTempDataDisk", "type": "bool"}, - "enable_over_provisioning": {"key": "properties.enableOverProvisioning", "type": "bool"}, - "zones": {"key": "properties.zones", "type": "[str]"}, - "is_spot_vm": {"key": "properties.isSpotVM", "type": "bool"}, - "host_group_id": {"key": "properties.hostGroupId", "type": "str"}, - "use_ephemeral_os_disk": {"key": "properties.useEphemeralOSDisk", "type": "bool"}, - "spot_restore_timeout": {"key": "properties.spotRestoreTimeout", "type": "str"}, - "eviction_policy": {"key": "properties.evictionPolicy", "type": "str"}, - "vm_image_resource_id": {"key": "properties.vmImageResourceId", "type": "str"}, - "subnet_id": {"key": "properties.subnetId", "type": "str"}, - "vm_setup_actions": {"key": "properties.vmSetupActions", "type": "[str]"}, - "security_type": {"key": "properties.securityType", "type": "str"}, - "secure_boot_enabled": {"key": "properties.secureBootEnabled", "type": "bool"}, - "enable_node_public_ip": {"key": "properties.enableNodePublicIP", "type": "bool"}, - "enable_node_public_i_pv6": {"key": "properties.enableNodePublicIPv6", "type": "bool"}, - "vm_shared_gallery_image_id": {"key": "properties.vmSharedGalleryImageId", "type": "str"}, - "nat_gateway_id": {"key": "properties.natGatewayId", "type": "str"}, - "nat_configurations": {"key": "properties.natConfigurations", "type": "[NodeTypeNatConfig]"}, - "vm_image_plan": {"key": "properties.vmImagePlan", "type": "VmImagePlan"}, - "service_artifact_reference_id": {"key": "properties.serviceArtifactReferenceId", "type": "str"}, - "dscp_configuration_id": {"key": "properties.dscpConfigurationId", "type": "str"}, - "additional_network_interface_configurations": { - "key": "properties.additionalNetworkInterfaceConfigurations", - "type": "[AdditionalNetworkInterfaceConfiguration]", - }, - "computer_name_prefix": {"key": "properties.computerNamePrefix", "type": "str"}, - "vm_applications": {"key": "properties.vmApplications", "type": "[VmApplication]"}, - } - - def __init__( # pylint: disable=too-many-locals - self, - *, - tags: Optional[Dict[str, str]] = None, - sku: Optional["_models.NodeTypeSku"] = None, - is_primary: Optional[bool] = None, - vm_instance_count: Optional[int] = None, - data_disk_size_gb: Optional[int] = None, - data_disk_type: Union[str, "_models.DiskType"] = "StandardSSD_LRS", - data_disk_letter: Optional[str] = None, - placement_properties: Optional[Dict[str, str]] = None, - capacities: Optional[Dict[str, str]] = None, - application_ports: Optional["_models.EndpointRangeDescription"] = None, - ephemeral_ports: Optional["_models.EndpointRangeDescription"] = None, - vm_size: Optional[str] = None, - vm_image_publisher: Optional[str] = None, - vm_image_offer: Optional[str] = None, - vm_image_sku: Optional[str] = None, - vm_image_version: Optional[str] = None, - vm_secrets: Optional[List["_models.VaultSecretGroup"]] = None, - vm_extensions: Optional[List["_models.VMSSExtension"]] = None, - vm_managed_identity: Optional["_models.VmManagedIdentity"] = None, - is_stateless: bool = False, - multiple_placement_groups: bool = False, - frontend_configurations: Optional[List["_models.FrontendConfiguration"]] = None, - network_security_rules: Optional[List["_models.NetworkSecurityRule"]] = None, - additional_data_disks: Optional[List["_models.VmssDataDisk"]] = None, - enable_encryption_at_host: bool = False, - enable_accelerated_networking: Optional[bool] = None, - use_default_public_load_balancer: Optional[bool] = None, - use_temp_data_disk: Optional[bool] = None, - enable_over_provisioning: Optional[bool] = None, - zones: Optional[List[str]] = None, - is_spot_vm: Optional[bool] = None, - host_group_id: Optional[str] = None, - use_ephemeral_os_disk: Optional[bool] = None, - spot_restore_timeout: Optional[str] = None, - eviction_policy: Optional[Union[str, "_models.EvictionPolicyType"]] = None, - vm_image_resource_id: Optional[str] = None, - subnet_id: Optional[str] = None, - vm_setup_actions: Optional[List[Union[str, "_models.VmSetupAction"]]] = None, - security_type: Optional[Union[str, "_models.SecurityType"]] = None, - secure_boot_enabled: Optional[bool] = None, - enable_node_public_ip: Optional[bool] = None, - enable_node_public_i_pv6: Optional[bool] = None, - vm_shared_gallery_image_id: Optional[str] = None, - nat_gateway_id: Optional[str] = None, - nat_configurations: Optional[List["_models.NodeTypeNatConfig"]] = None, - vm_image_plan: Optional["_models.VmImagePlan"] = None, - service_artifact_reference_id: Optional[str] = None, - dscp_configuration_id: Optional[str] = None, - additional_network_interface_configurations: Optional[ - List["_models.AdditionalNetworkInterfaceConfiguration"] - ] = None, - computer_name_prefix: Optional[str] = None, - vm_applications: Optional[List["_models.VmApplication"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - :keyword sku: The node type sku. - :paramtype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku - :keyword is_primary: Indicates the Service Fabric system services for the cluster will run on - this node type. This setting cannot be changed once the node type is created. - :paramtype is_primary: bool - :keyword vm_instance_count: The number of nodes in the node type. :code:`
`:code:`
`\\ **Values:** :code:`
`-1 - Use when auto scale rules are configured or sku.capacity - is defined :code:`
` 0 - Not supported :code:`
` >0 - Use for manual scale. - :paramtype vm_instance_count: int - :keyword data_disk_size_gb: Disk size for the managed disk attached to the vms on the node type - in GBs. - :paramtype data_disk_size_gb: int - :keyword data_disk_type: Managed data disk type. Specifies the storage account type for the - managed disk. Known values are: "Standard_LRS", "StandardSSD_LRS", and "Premium_LRS". - :paramtype data_disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType - :keyword data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D - and it can not change after created. - :paramtype data_disk_letter: str - :keyword placement_properties: The placement tags applied to nodes in the node type, which can - be used to indicate where certain services (workload) should run. - :paramtype placement_properties: dict[str, str] - :keyword capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :paramtype capacities: dict[str, str] - :keyword application_ports: The range of ports from which cluster assigned port to Service - Fabric applications. - :paramtype application_ports: - ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription - :keyword ephemeral_ports: The range of ephemeral ports that nodes in this node type should be - configured with. - :paramtype ephemeral_ports: - ~azure.mgmt.servicefabricmanagedclusters.models.EndpointRangeDescription - :keyword vm_size: The size of virtual machines in the pool. All virtual machines in a pool are - the same size. For example, Standard_D3. - :paramtype vm_size: str - :keyword vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For - example, Canonical or MicrosoftWindowsServer. - :paramtype vm_image_publisher: str - :keyword vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For - example, UbuntuServer or WindowsServer. - :paramtype vm_image_offer: str - :keyword vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, - 14.04.0-LTS or 2012-R2-Datacenter. - :paramtype vm_image_sku: str - :keyword vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value - of 'latest' can be specified to select the latest version of an image. If omitted, the default - is 'latest'. - :paramtype vm_image_version: str - :keyword vm_secrets: The secrets to install in the virtual machines. - :paramtype vm_secrets: list[~azure.mgmt.servicefabricmanagedclusters.models.VaultSecretGroup] - :keyword vm_extensions: Set of extensions that should be installed onto the virtual machines. - :paramtype vm_extensions: list[~azure.mgmt.servicefabricmanagedclusters.models.VMSSExtension] - :keyword vm_managed_identity: Identities to assign to the virtual machine scale set under the - node type. - :paramtype vm_managed_identity: - ~azure.mgmt.servicefabricmanagedclusters.models.VmManagedIdentity - :keyword is_stateless: Indicates if the node type can only host Stateless workloads. - :paramtype is_stateless: bool - :keyword multiple_placement_groups: Indicates if scale set associated with the node type can be - composed of multiple placement groups. - :paramtype multiple_placement_groups: bool - :keyword frontend_configurations: Indicates the node type uses its own frontend configurations - instead of the default one for the cluster. This setting can only be specified for non-primary - node types and can not be added or removed after the node type is created. - :paramtype frontend_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.FrontendConfiguration] - :keyword network_security_rules: The Network Security Rules for this node type. This setting - can only be specified for node types that are configured with frontend configurations. - :paramtype network_security_rules: - list[~azure.mgmt.servicefabricmanagedclusters.models.NetworkSecurityRule] - :keyword additional_data_disks: Additional managed data disks. - :paramtype additional_data_disks: - list[~azure.mgmt.servicefabricmanagedclusters.models.VmssDataDisk] - :keyword enable_encryption_at_host: Enable or disable the Host Encryption for the virtual - machines on the node type. This will enable the encryption for all the disks including - Resource/Temp disk at host itself. Default: The Encryption at host will be disabled unless this - property is set to true for the resource. - :paramtype enable_encryption_at_host: bool - :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated - networking-enabled. - :paramtype enable_accelerated_networking: bool - :keyword use_default_public_load_balancer: Specifies whether the use public load balancer. If - not specified and the node type doesn't have its own frontend configuration, it will be - attached to the default load balancer. If the node type uses its own Load balancer and - useDefaultPublicLoadBalancer is true, then the frontend has to be an Internal Load Balancer. If - the node type uses its own Load balancer and useDefaultPublicLoadBalancer is false or not set, - then the custom load balancer must include a public load balancer to provide outbound - connectivity. - :paramtype use_default_public_load_balancer: bool - :keyword use_temp_data_disk: Specifies whether to use the temporary disk for the service fabric - data root, in which case no managed data disk will be attached and the temporary disk will be - used. It is only allowed for stateless node types. - :paramtype use_temp_data_disk: bool - :keyword enable_over_provisioning: Specifies whether the node type should be overprovisioned. - It is only allowed for stateless node types. - :paramtype enable_over_provisioning: bool - :keyword zones: Specifies the availability zones where the node type would span across. If the - cluster is not spanning across availability zones, initiates az migration for the cluster. - :paramtype zones: list[str] - :keyword is_spot_vm: Indicates whether the node type will be Spot Virtual Machines. Azure will - allocate the VMs if there is capacity available and the VMs can be evicted at any time. - :paramtype is_spot_vm: bool - :keyword host_group_id: Specifies the full host group resource Id. This property is used for - deploying on azure dedicated hosts. - :paramtype host_group_id: str - :keyword use_ephemeral_os_disk: Indicates whether to use ephemeral os disk. The sku selected on - the vmSize property needs to support this feature. - :paramtype use_ephemeral_os_disk: bool - :keyword spot_restore_timeout: Indicates the time duration after which the platform will not - try to restore the VMSS SPOT instances specified as ISO 8601. - :paramtype spot_restore_timeout: str - :keyword eviction_policy: Specifies the eviction policy for virtual machines in a SPOT node - type. Default is Delete. Known values are: "Delete" and "Deallocate". - :paramtype eviction_policy: str or - ~azure.mgmt.servicefabricmanagedclusters.models.EvictionPolicyType - :keyword vm_image_resource_id: Indicates the resource id of the vm image. This parameter is - used for custom vm image. - :paramtype vm_image_resource_id: str - :keyword subnet_id: Indicates the resource id of the subnet for the node type. - :paramtype subnet_id: str - :keyword vm_setup_actions: Specifies the actions to be performed on the vms before - bootstrapping the service fabric runtime. - :paramtype vm_setup_actions: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.VmSetupAction] - :keyword security_type: Specifies the security type of the nodeType. Only Standard and - TrustedLaunch are currently supported. Known values are: "TrustedLaunch" and "Standard". - :paramtype security_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.SecurityType - :keyword secure_boot_enabled: Specifies whether secure boot should be enabled on the nodeType. - Can only be used with TrustedLaunch SecurityType. - :paramtype secure_boot_enabled: bool - :keyword enable_node_public_ip: Specifies whether each node is allocated its own public IPv4 - address. This is only supported on secondary node types with custom Load Balancers. - :paramtype enable_node_public_ip: bool - :keyword enable_node_public_i_pv6: Specifies whether each node is allocated its own public IPv6 - address. This is only supported on secondary node types with custom Load Balancers. - :paramtype enable_node_public_i_pv6: bool - :keyword vm_shared_gallery_image_id: Indicates the resource id of the vm shared galleries - image. This parameter is used for custom vm image. - :paramtype vm_shared_gallery_image_id: str - :keyword nat_gateway_id: Specifies the resource id of a NAT Gateway to attach to the subnet of - this node type. Node type must use custom load balancer. - :paramtype nat_gateway_id: str - :keyword nat_configurations: Specifies the NAT configuration on default public Load Balancer - for the node type. This is only supported for node types use the default public Load Balancer. - :paramtype nat_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeNatConfig] - :keyword vm_image_plan: Specifies information about the marketplace image used to create the - virtual machine. This element is only used for marketplace images. Before you can use a - marketplace image from an API, you must enable the image for programmatic use. In the Azure - portal, find the marketplace image that you want to use and then click Want to deploy - programmatically, Get Started ->. Enter any required information and then click Save. - :paramtype vm_image_plan: ~azure.mgmt.servicefabricmanagedclusters.models.VmImagePlan - :keyword service_artifact_reference_id: Specifies the service artifact reference id used to set - same image version for all virtual machines in the scale set when using 'latest' image version. - :paramtype service_artifact_reference_id: str - :keyword dscp_configuration_id: Specifies the resource id of the DSCP configuration to apply to - the node type network interface. - :paramtype dscp_configuration_id: str - :keyword additional_network_interface_configurations: Specifies the settings for any additional - secondary network interfaces to attach to the node type. - :paramtype additional_network_interface_configurations: - list[~azure.mgmt.servicefabricmanagedclusters.models.AdditionalNetworkInterfaceConfiguration] - :keyword computer_name_prefix: Specifies the computer name prefix. Limited to 9 characters. If - specified, allows for a longer name to be specified for the node type name. - :paramtype computer_name_prefix: str - :keyword vm_applications: Specifies the gallery applications that should be made available to - the underlying VMSS. - :paramtype vm_applications: list[~azure.mgmt.servicefabricmanagedclusters.models.VmApplication] - """ - super().__init__(tags=tags, **kwargs) - self.sku = sku - self.is_primary = is_primary - self.vm_instance_count = vm_instance_count - self.data_disk_size_gb = data_disk_size_gb - self.data_disk_type = data_disk_type - self.data_disk_letter = data_disk_letter - self.placement_properties = placement_properties - self.capacities = capacities - self.application_ports = application_ports - self.ephemeral_ports = ephemeral_ports - self.vm_size = vm_size - self.vm_image_publisher = vm_image_publisher - self.vm_image_offer = vm_image_offer - self.vm_image_sku = vm_image_sku - self.vm_image_version = vm_image_version - self.vm_secrets = vm_secrets - self.vm_extensions = vm_extensions - self.vm_managed_identity = vm_managed_identity - self.is_stateless = is_stateless - self.multiple_placement_groups = multiple_placement_groups - self.frontend_configurations = frontend_configurations - self.network_security_rules = network_security_rules - self.additional_data_disks = additional_data_disks - self.enable_encryption_at_host = enable_encryption_at_host - self.provisioning_state = None - self.enable_accelerated_networking = enable_accelerated_networking - self.use_default_public_load_balancer = use_default_public_load_balancer - self.use_temp_data_disk = use_temp_data_disk - self.enable_over_provisioning = enable_over_provisioning - self.zones = zones - self.is_spot_vm = is_spot_vm - self.host_group_id = host_group_id - self.use_ephemeral_os_disk = use_ephemeral_os_disk - self.spot_restore_timeout = spot_restore_timeout - self.eviction_policy = eviction_policy - self.vm_image_resource_id = vm_image_resource_id - self.subnet_id = subnet_id - self.vm_setup_actions = vm_setup_actions - self.security_type = security_type - self.secure_boot_enabled = secure_boot_enabled - self.enable_node_public_ip = enable_node_public_ip - self.enable_node_public_i_pv6 = enable_node_public_i_pv6 - self.vm_shared_gallery_image_id = vm_shared_gallery_image_id - self.nat_gateway_id = nat_gateway_id - self.nat_configurations = nat_configurations - self.vm_image_plan = vm_image_plan - self.service_artifact_reference_id = service_artifact_reference_id - self.dscp_configuration_id = dscp_configuration_id - self.additional_network_interface_configurations = additional_network_interface_configurations - self.computer_name_prefix = computer_name_prefix - self.vm_applications = vm_applications - - -class NodeTypeActionParameters(_serialization.Model): - """Parameters for Node type action. If nodes are not specified on the parameters, the operation - will be performed in all nodes of the node type one upgrade domain at a time. - - :ivar nodes: List of node names from the node type. - :vartype nodes: list[str] - :ivar force: Force the action to go through. - :vartype force: bool - :ivar update_type: Specifies the way the operation will be performed. Known values are: - "Default" and "ByUpgradeDomain". - :vartype update_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.UpdateType - """ - - _attribute_map = { - "nodes": {"key": "nodes", "type": "[str]"}, - "force": {"key": "force", "type": "bool"}, - "update_type": {"key": "updateType", "type": "str"}, - } - - def __init__( - self, - *, - nodes: Optional[List[str]] = None, - force: Optional[bool] = None, - update_type: Optional[Union[str, "_models.UpdateType"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword nodes: List of node names from the node type. - :paramtype nodes: list[str] - :keyword force: Force the action to go through. - :paramtype force: bool - :keyword update_type: Specifies the way the operation will be performed. Known values are: - "Default" and "ByUpgradeDomain". - :paramtype update_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.UpdateType - """ - super().__init__(**kwargs) - self.nodes = nodes - self.force = force - self.update_type = update_type - - -class NodeTypeAvailableSku(_serialization.Model): - """Defines the type of sku available for a node type. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_type: The type of resource the sku applies to. :code:`
`:code:`
`Value: Microsoft.ServiceFabric/managedClusters/nodeTypes. - :vartype resource_type: str - :ivar sku: The supported SKU for a for node type. - :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSupportedSku - :ivar capacity: Provides information about how the node count can be scaled. - :vartype capacity: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuCapacity - """ - - _validation = { - "resource_type": {"readonly": True}, - "sku": {"readonly": True}, - "capacity": {"readonly": True}, - } - - _attribute_map = { - "resource_type": {"key": "resourceType", "type": "str"}, - "sku": {"key": "sku", "type": "NodeTypeSupportedSku"}, - "capacity": {"key": "capacity", "type": "NodeTypeSkuCapacity"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_type = None - self.sku = None - self.capacity = None - - -class NodeTypeListResult(_serialization.Model): - """Node type list results. - - :ivar value: The list of node types. - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NodeType]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: Optional[List["_models.NodeType"]] = None, next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The list of node types. - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NodeTypeListSkuResult(_serialization.Model): - """Node type available sku list results. - - :ivar value: The list of available node type SKUs. - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[NodeTypeAvailableSku]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.NodeTypeAvailableSku"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of available node type SKUs. - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class NodeTypeNatConfig(_serialization.Model): - """Provides information about NAT configuration on the default public Load Balancer for the node - type. - - :ivar backend_port: The internal port for the NAT configuration. - :vartype backend_port: int - :ivar frontend_port_range_start: The port range start for the external endpoint. - :vartype frontend_port_range_start: int - :ivar frontend_port_range_end: The port range end for the external endpoint. - :vartype frontend_port_range_end: int - """ - - _validation = { - "backend_port": {"maximum": 65535, "minimum": 1}, - "frontend_port_range_start": {"maximum": 65534, "minimum": 1}, - "frontend_port_range_end": {"maximum": 65534, "minimum": 1}, - } - - _attribute_map = { - "backend_port": {"key": "backendPort", "type": "int"}, - "frontend_port_range_start": {"key": "frontendPortRangeStart", "type": "int"}, - "frontend_port_range_end": {"key": "frontendPortRangeEnd", "type": "int"}, - } - - def __init__( - self, - *, - backend_port: Optional[int] = None, - frontend_port_range_start: Optional[int] = None, - frontend_port_range_end: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword backend_port: The internal port for the NAT configuration. - :paramtype backend_port: int - :keyword frontend_port_range_start: The port range start for the external endpoint. - :paramtype frontend_port_range_start: int - :keyword frontend_port_range_end: The port range end for the external endpoint. - :paramtype frontend_port_range_end: int - """ - super().__init__(**kwargs) - self.backend_port = backend_port - self.frontend_port_range_start = frontend_port_range_start - self.frontend_port_range_end = frontend_port_range_end - - -class NodeTypeSku(_serialization.Model): - """Describes a node type sku. - - All required parameters must be populated in order to send to server. - - :ivar name: The sku name. :code:`
`:code:`
`Name is internally generated and is used - in auto-scale scenarios.:code:`
` Property does not allow to be changed to other values - than generated.:code:`
` To avoid deployment errors please omit the property. - :vartype name: str - :ivar tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible - Values::code:`
` **Standard**. - :vartype tier: str - :ivar capacity: The number of nodes in the node type.:code:`
`:code:`
`If present in - request it will override properties.vmInstanceCount. Required. - :vartype capacity: int - """ - - _validation = { - "capacity": {"required": True, "maximum": 2147483647, "minimum": 1}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - "capacity": {"key": "capacity", "type": "int"}, - } - - def __init__(self, *, capacity: int, name: Optional[str] = None, tier: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword name: The sku name. :code:`
`:code:`
`Name is internally generated and is - used in auto-scale scenarios.:code:`
` Property does not allow to be changed to other - values than generated.:code:`
` To avoid deployment errors please omit the property. - :paramtype name: str - :keyword tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible - Values::code:`
` **Standard**. - :paramtype tier: str - :keyword capacity: The number of nodes in the node type.:code:`
`:code:`
`If present - in request it will override properties.vmInstanceCount. Required. - :paramtype capacity: int - """ - super().__init__(**kwargs) - self.name = name - self.tier = tier - self.capacity = capacity - - -class NodeTypeSkuCapacity(_serialization.Model): - """Provides information about how node type can be scaled. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar minimum: Lowest permitted node count in a node type. - :vartype minimum: int - :ivar maximum: Highest permitted node count in a node type. - :vartype maximum: int - :ivar default: Default node count in a node type. - :vartype default: int - :ivar scale_type: Node type capacity scale type. Known values are: "None", "Manual", and - "Automatic". - :vartype scale_type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSkuScaleType - """ - - _validation = { - "minimum": {"readonly": True}, - "maximum": {"readonly": True}, - "default": {"readonly": True}, - "scale_type": {"readonly": True}, - } - - _attribute_map = { - "minimum": {"key": "minimum", "type": "int"}, - "maximum": {"key": "maximum", "type": "int"}, - "default": {"key": "default", "type": "int"}, - "scale_type": {"key": "scaleType", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.minimum = None - self.maximum = None - self.default = None - self.scale_type = None - - -class NodeTypeSupportedSku(_serialization.Model): - """Describes a node type supported sku. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The sku name. - :vartype name: str - :ivar tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible - Values::code:`
` **Standard**. - :vartype tier: str - """ - - _validation = { - "name": {"readonly": True}, - "tier": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "tier": {"key": "tier", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.tier = None - - -class NodeTypeUpdateParameters(_serialization.Model): - """Node type update request. - - :ivar tags: Node type update parameters. - :vartype tags: dict[str, str] - :ivar sku: The node type sku. - :vartype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "sku": {"key": "sku", "type": "NodeTypeSku"}, - } - - def __init__( - self, *, tags: Optional[Dict[str, str]] = None, sku: Optional["_models.NodeTypeSku"] = None, **kwargs: Any - ) -> None: - """ - :keyword tags: Node type update parameters. - :paramtype tags: dict[str, str] - :keyword sku: The node type sku. - :paramtype sku: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeSku - """ - super().__init__(**kwargs) - self.tags = tags - self.sku = sku - - -class OperationListResult(_serialization.Model): - """Describes the result of the request to list Service Fabric resource provider operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the Service Fabric resource provider. - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[OperationResult]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.OperationResult"]] = None, **kwargs: Any) -> None: - """ - :keyword value: List of operations supported by the Service Fabric resource provider. - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.OperationResult] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class OperationResult(_serialization.Model): - """Available operation list result. - - :ivar name: The name of the operation. - :vartype name: str - :ivar is_data_action: Indicates whether the operation is a data action. - :vartype is_data_action: bool - :ivar display: The object that represents the operation. - :vartype display: ~azure.mgmt.servicefabricmanagedclusters.models.AvailableOperationDisplay - :ivar origin: Origin result. - :vartype origin: str - :ivar next_link: The URL to use for getting the next set of results. - :vartype next_link: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "AvailableOperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - is_data_action: Optional[bool] = None, - display: Optional["_models.AvailableOperationDisplay"] = None, - origin: Optional[str] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the operation. - :paramtype name: str - :keyword is_data_action: Indicates whether the operation is a data action. - :paramtype is_data_action: bool - :keyword display: The object that represents the operation. - :paramtype display: ~azure.mgmt.servicefabricmanagedclusters.models.AvailableOperationDisplay - :keyword origin: Origin result. - :paramtype origin: str - :keyword next_link: The URL to use for getting the next set of results. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.name = name - self.is_data_action = is_data_action - self.display = display - self.origin = origin - self.next_link = next_link - - -class PartitionInstanceCountScaleMechanism(ScalingMechanism): - """Represents a scaling mechanism for adding or removing instances of stateless service partition. - - All required parameters must be populated in order to send to server. - - :ivar kind: Specifies the mechanism associated with this scaling policy. Required. Known values - are: "ScalePartitionInstanceCount" and "AddRemoveIncrementalNamedPartition". - :vartype kind: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceScalingMechanismKind - :ivar min_instance_count: Minimum number of instances of the partition. Required. - :vartype min_instance_count: int - :ivar max_instance_count: Maximum number of instances of the partition. Required. - :vartype max_instance_count: int - :ivar scale_increment: The number of instances to add or remove during a scaling operation. - Required. - :vartype scale_increment: int - """ - - _validation = { - "kind": {"required": True}, - "min_instance_count": {"required": True}, - "max_instance_count": {"required": True}, - "scale_increment": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - "min_instance_count": {"key": "minInstanceCount", "type": "int"}, - "max_instance_count": {"key": "maxInstanceCount", "type": "int"}, - "scale_increment": {"key": "scaleIncrement", "type": "int"}, - } - - def __init__( - self, *, min_instance_count: int, max_instance_count: int, scale_increment: int, **kwargs: Any - ) -> None: - """ - :keyword min_instance_count: Minimum number of instances of the partition. Required. - :paramtype min_instance_count: int - :keyword max_instance_count: Maximum number of instances of the partition. Required. - :paramtype max_instance_count: int - :keyword scale_increment: The number of instances to add or remove during a scaling operation. - Required. - :paramtype scale_increment: int - """ - super().__init__(**kwargs) - self.kind: str = "ScalePartitionInstanceCount" - self.min_instance_count = min_instance_count - self.max_instance_count = max_instance_count - self.scale_increment = scale_increment - - -class ResourceAzStatus(_serialization.Model): - """Describes Az Resiliency status of Base resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar resource_name: VM Size properties. - :vartype resource_name: str - :ivar resource_type: VM Size id. - :vartype resource_type: str - :ivar is_zone_resilient: VM Size name. - :vartype is_zone_resilient: bool - :ivar details: Zone resiliency status details for the resource. - :vartype details: str - """ - - _validation = { - "resource_name": {"readonly": True}, - "resource_type": {"readonly": True}, - "is_zone_resilient": {"readonly": True}, - "details": {"readonly": True}, - } - - _attribute_map = { - "resource_name": {"key": "resourceName", "type": "str"}, - "resource_type": {"key": "resourceType", "type": "str"}, - "is_zone_resilient": {"key": "isZoneResilient", "type": "bool"}, - "details": {"key": "details", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.resource_name = None - self.resource_type = None - self.is_zone_resilient = None - self.details = None - - -class RollingUpgradeMonitoringPolicy(_serialization.Model): - """The policy used for monitoring the application upgrade. - - All required parameters must be populated in order to send to server. - - :ivar failure_action: The compensating action to perform when a Monitored upgrade encounters - monitoring policy or health policy violations. Invalid indicates the failure action is invalid. - Rollback specifies that the upgrade will start rolling back automatically. Manual indicates - that the upgrade will switch to UnmonitoredManual upgrade mode. Required. Known values are: - "Rollback" and "Manual". - :vartype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction - :ivar health_check_wait_duration: The amount of time to wait after completing an upgrade domain - before applying health policies. It is interpreted as a string representing an ISO 8601 - duration with following format "hh:mm:ss.fff". Required. - :vartype health_check_wait_duration: str - :ivar health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. It is interpreted as a - string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :vartype health_check_stable_duration: str - :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before FailureAction is executed. It is interpreted as a - string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :vartype health_check_retry_timeout: str - :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before - FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :vartype upgrade_timeout: str - :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before - FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :vartype upgrade_domain_timeout: str - """ - - _validation = { - "failure_action": {"required": True}, - "health_check_wait_duration": {"required": True}, - "health_check_stable_duration": {"required": True}, - "health_check_retry_timeout": {"required": True}, - "upgrade_timeout": {"required": True}, - "upgrade_domain_timeout": {"required": True}, - } - - _attribute_map = { - "failure_action": {"key": "failureAction", "type": "str"}, - "health_check_wait_duration": {"key": "healthCheckWaitDuration", "type": "str"}, - "health_check_stable_duration": {"key": "healthCheckStableDuration", "type": "str"}, - "health_check_retry_timeout": {"key": "healthCheckRetryTimeout", "type": "str"}, - "upgrade_timeout": {"key": "upgradeTimeout", "type": "str"}, - "upgrade_domain_timeout": {"key": "upgradeDomainTimeout", "type": "str"}, - } - - def __init__( - self, - *, - failure_action: Union[str, "_models.FailureAction"], - health_check_wait_duration: str, - health_check_stable_duration: str, - health_check_retry_timeout: str, - upgrade_timeout: str, - upgrade_domain_timeout: str, - **kwargs: Any - ) -> None: - """ - :keyword failure_action: The compensating action to perform when a Monitored upgrade encounters - monitoring policy or health policy violations. Invalid indicates the failure action is invalid. - Rollback specifies that the upgrade will start rolling back automatically. Manual indicates - that the upgrade will switch to UnmonitoredManual upgrade mode. Required. Known values are: - "Rollback" and "Manual". - :paramtype failure_action: str or ~azure.mgmt.servicefabricmanagedclusters.models.FailureAction - :keyword health_check_wait_duration: The amount of time to wait after completing an upgrade - domain before applying health policies. It is interpreted as a string representing an ISO 8601 - duration with following format "hh:mm:ss.fff". Required. - :paramtype health_check_wait_duration: str - :keyword health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. It is interpreted as a - string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :paramtype health_check_stable_duration: str - :keyword health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before FailureAction is executed. It is interpreted as a - string representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :paramtype health_check_retry_timeout: str - :keyword upgrade_timeout: The amount of time the overall upgrade has to complete before - FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :paramtype upgrade_timeout: str - :keyword upgrade_domain_timeout: The amount of time each upgrade domain has to complete before - FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string - representing an ISO 8601 duration with following format "hh:mm:ss.fff". Required. - :paramtype upgrade_domain_timeout: str - """ - super().__init__(**kwargs) - self.failure_action = failure_action - self.health_check_wait_duration = health_check_wait_duration - self.health_check_stable_duration = health_check_stable_duration - self.health_check_retry_timeout = health_check_retry_timeout - self.upgrade_timeout = upgrade_timeout - self.upgrade_domain_timeout = upgrade_domain_timeout - - -class RuntimeResumeApplicationUpgradeParameters(_serialization.Model): # pylint: disable=name-too-long - """Parameters for Resume Upgrade action. The upgrade domain name must be specified. - - :ivar upgrade_domain_name: The upgrade domain name. Expected to be the next upgrade domain if - the application is upgrading. - :vartype upgrade_domain_name: str - """ - - _attribute_map = { - "upgrade_domain_name": {"key": "upgradeDomainName", "type": "str"}, - } - - def __init__(self, *, upgrade_domain_name: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword upgrade_domain_name: The upgrade domain name. Expected to be the next upgrade domain - if the application is upgrading. - :paramtype upgrade_domain_name: str - """ - super().__init__(**kwargs) - self.upgrade_domain_name = upgrade_domain_name - - -class ScalingPolicy(_serialization.Model): - """Specifies a metric to load balance a service during runtime. - - All required parameters must be populated in order to send to server. - - :ivar scaling_mechanism: Specifies the mechanism associated with this scaling policy. Required. - :vartype scaling_mechanism: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingMechanism - :ivar scaling_trigger: Specifies the trigger associated with this scaling policy. Required. - :vartype scaling_trigger: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingTrigger - """ - - _validation = { - "scaling_mechanism": {"required": True}, - "scaling_trigger": {"required": True}, - } - - _attribute_map = { - "scaling_mechanism": {"key": "scalingMechanism", "type": "ScalingMechanism"}, - "scaling_trigger": {"key": "scalingTrigger", "type": "ScalingTrigger"}, - } - - def __init__( - self, *, scaling_mechanism: "_models.ScalingMechanism", scaling_trigger: "_models.ScalingTrigger", **kwargs: Any - ) -> None: - """ - :keyword scaling_mechanism: Specifies the mechanism associated with this scaling policy. - Required. - :paramtype scaling_mechanism: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingMechanism - :keyword scaling_trigger: Specifies the trigger associated with this scaling policy. Required. - :paramtype scaling_trigger: ~azure.mgmt.servicefabricmanagedclusters.models.ScalingTrigger - """ - super().__init__(**kwargs) - self.scaling_mechanism = scaling_mechanism - self.scaling_trigger = scaling_trigger - - -class ServiceCorrelation(_serialization.Model): - """Creates a particular correlation between services. - - All required parameters must be populated in order to send to server. - - :ivar scheme: The ServiceCorrelationScheme which describes the relationship between this - service and the service specified via ServiceName. Required. Known values are: - "AlignedAffinity" and "NonAlignedAffinity". - :vartype scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme - :ivar service_name: The Arm Resource ID of the service that the correlation relationship is - established with. Required. - :vartype service_name: str - """ - - _validation = { - "scheme": {"required": True}, - "service_name": {"required": True}, - } - - _attribute_map = { - "scheme": {"key": "scheme", "type": "str"}, - "service_name": {"key": "serviceName", "type": "str"}, - } - - def __init__( - self, *, scheme: Union[str, "_models.ServiceCorrelationScheme"], service_name: str, **kwargs: Any - ) -> None: - """ - :keyword scheme: The ServiceCorrelationScheme which describes the relationship between this - service and the service specified via ServiceName. Required. Known values are: - "AlignedAffinity" and "NonAlignedAffinity". - :paramtype scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelationScheme - :keyword service_name: The Arm Resource ID of the service that the correlation relationship is - established with. Required. - :paramtype service_name: str - """ - super().__init__(**kwargs) - self.scheme = scheme - self.service_name = service_name - - -class ServiceEndpoint(_serialization.Model): - """The service endpoint properties. - - All required parameters must be populated in order to send to server. - - :ivar service: The type of the endpoint service. Required. - :vartype service: str - :ivar locations: A list of locations. - :vartype locations: list[str] - """ - - _validation = { - "service": {"required": True}, - } - - _attribute_map = { - "service": {"key": "service", "type": "str"}, - "locations": {"key": "locations", "type": "[str]"}, - } - - def __init__(self, *, service: str, locations: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword service: The type of the endpoint service. Required. - :paramtype service: str - :keyword locations: A list of locations. - :paramtype locations: list[str] - """ - super().__init__(**kwargs) - self.service = service - self.locations = locations - - -class ServiceLoadMetric(_serialization.Model): - """Specifies a metric to load balance a service during runtime. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the metric. If the service chooses to report load during runtime, the - load metric name should match the name that is specified in Name exactly. Note that metric - names are case sensitive. Required. - :vartype name: str - :ivar weight: The service load metric relative weight, compared to other metrics configured for - this service, as a number. Known values are: "Zero", "Low", "Medium", and "High". - :vartype weight: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight - :ivar primary_default_load: Used only for Stateful services. The default amount of load, as a - number, that this service creates for this metric when it is a Primary replica. - :vartype primary_default_load: int - :ivar secondary_default_load: Used only for Stateful services. The default amount of load, as a - number, that this service creates for this metric when it is a Secondary replica. - :vartype secondary_default_load: int - :ivar default_load: Used only for Stateless services. The default amount of load, as a number, - that this service creates for this metric. - :vartype default_load: int - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "weight": {"key": "weight", "type": "str"}, - "primary_default_load": {"key": "primaryDefaultLoad", "type": "int"}, - "secondary_default_load": {"key": "secondaryDefaultLoad", "type": "int"}, - "default_load": {"key": "defaultLoad", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - weight: Optional[Union[str, "_models.ServiceLoadMetricWeight"]] = None, - primary_default_load: Optional[int] = None, - secondary_default_load: Optional[int] = None, - default_load: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the metric. If the service chooses to report load during runtime, - the load metric name should match the name that is specified in Name exactly. Note that metric - names are case sensitive. Required. - :paramtype name: str - :keyword weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Known values are: "Zero", "Low", "Medium", and "High". - :paramtype weight: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetricWeight - :keyword primary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Primary replica. - :paramtype primary_default_load: int - :keyword secondary_default_load: Used only for Stateful services. The default amount of load, - as a number, that this service creates for this metric when it is a Secondary replica. - :paramtype secondary_default_load: int - :keyword default_load: Used only for Stateless services. The default amount of load, as a - number, that this service creates for this metric. - :paramtype default_load: int - """ - super().__init__(**kwargs) - self.name = name - self.weight = weight - self.primary_default_load = primary_default_load - self.secondary_default_load = secondary_default_load - self.default_load = default_load - - -class ServicePlacementPolicy(_serialization.Model): - """Describes the policy to be used for placement of a Service Fabric service. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - ServicePlacementInvalidDomainPolicy, ServicePlacementNonPartiallyPlaceServicePolicy, - ServicePlacementPreferPrimaryDomainPolicy, ServicePlacementRequiredDomainPolicy, - ServicePlacementRequireDomainDistributionPolicy - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - _subtype_map = { - "type": { - "InvalidDomain": "ServicePlacementInvalidDomainPolicy", - "NonPartiallyPlaceService": "ServicePlacementNonPartiallyPlaceServicePolicy", - "PreferredPrimaryDomain": "ServicePlacementPreferPrimaryDomainPolicy", - "RequiredDomain": "ServicePlacementRequiredDomainPolicy", - "RequiredDomainDistribution": "ServicePlacementRequireDomainDistributionPolicy", - } - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: Optional[str] = None - - -class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): - """Describes the policy to be used for placement of a Service Fabric service where a particular - fault or upgrade domain should not be used for placement of the instances or replicas of that - service. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - :ivar domain_name: The name of the domain that should not be used for placement. Required. - :vartype domain_name: str - """ - - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, *, domain_name: str, **kwargs: Any) -> None: - """ - :keyword domain_name: The name of the domain that should not be used for placement. Required. - :paramtype domain_name: str - """ - super().__init__(**kwargs) - self.type: str = "InvalidDomain" - self.domain_name = domain_name - - -class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): # pylint: disable=name-too-long - """ServicePlacementNonPartiallyPlaceServicePolicy. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type: str = "NonPartiallyPlaceService" - - -class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): # pylint: disable=name-too-long - """Describes the policy to be used for placement of a Service Fabric service where the service's - Primary replicas should optimally be placed in a particular domain. - - This placement policy is usually used with fault domains in scenarios where the Service Fabric - cluster is geographically distributed in order to indicate that a service's primary replica - should - be located in a particular fault domain, which in geo-distributed scenarios usually aligns with - regional - or datacenter boundaries. Note that since this is an optimization it is possible that the - Primary replica - may not end up located in this domain due to failures, capacity limits, or other constraints. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - :ivar domain_name: The name of the domain that should used for placement as per this policy. - Required. - :vartype domain_name: str - """ - - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, *, domain_name: str, **kwargs: Any) -> None: - """ - :keyword domain_name: The name of the domain that should used for placement as per this policy. - Required. - :paramtype domain_name: str - """ - super().__init__(**kwargs) - self.type: str = "PreferredPrimaryDomain" - self.domain_name = domain_name - - -class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): - """Describes the policy to be used for placement of a Service Fabric service where the instances - or replicas of that service must be placed in a particular domain. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - :ivar domain_name: The name of the domain that should used for placement as per this policy. - Required. - :vartype domain_name: str - """ - - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, *, domain_name: str, **kwargs: Any) -> None: - """ - :keyword domain_name: The name of the domain that should used for placement as per this policy. - Required. - :paramtype domain_name: str - """ - super().__init__(**kwargs) - self.type: str = "RequiredDomain" - self.domain_name = domain_name - - -class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): # pylint: disable=name-too-long - """Describes the policy to be used for placement of a Service Fabric service where two replicas - from the same partition should never be placed in the same fault or upgrade domain. - - While this is not common it can expose the service to an increased risk of concurrent failures - due to unplanned outages or other cases of subsequent/concurrent failures. As an example, - consider - a case where replicas are deployed across different data center, with one replica per location. - In the event that one of the datacenters goes offline, normally the replica that was placed in - that - datacenter will be packed into one of the remaining datacenters. If this is not desirable then - this - policy should be set. - - All required parameters must be populated in order to send to server. - - :ivar type: The type of placement policy for a service fabric service. Following are the - possible values. Required. Known values are: "InvalidDomain", "RequiredDomain", - "PreferredPrimaryDomain", "RequiredDomainDistribution", and "NonPartiallyPlaceService". - :vartype type: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicyType - :ivar domain_name: The name of the domain that should used for placement as per this policy. - Required. - :vartype domain_name: str - """ - - _validation = { - "type": {"required": True}, - "domain_name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "domain_name": {"key": "domainName", "type": "str"}, - } - - def __init__(self, *, domain_name: str, **kwargs: Any) -> None: - """ - :keyword domain_name: The name of the domain that should used for placement as per this policy. - Required. - :paramtype domain_name: str - """ - super().__init__(**kwargs) - self.type: str = "RequiredDomainDistribution" - self.domain_name = domain_name - - -class ServiceResource(ProxyResource): - """The service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :ivar location: Resource location depends on the parent resource. - :vartype location: str - :ivar tags: Azure resource tags. - :vartype tags: dict[str, str] - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabricmanagedclusters.models.SystemData - :ivar properties: The service resource properties. - :vartype properties: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceProperties - """ - - _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"}, - "location": {"key": "location", "type": "str"}, - "tags": {"key": "tags", "type": "{str}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "properties": {"key": "properties", "type": "ServiceResourceProperties"}, - } - - def __init__( - self, - *, - location: Optional[str] = None, - tags: Optional[Dict[str, str]] = None, - properties: Optional["_models.ServiceResourceProperties"] = None, - **kwargs: Any - ) -> None: - """ - :keyword location: Resource location depends on the parent resource. - :paramtype location: str - :keyword tags: Azure resource tags. - :paramtype tags: dict[str, str] - :keyword properties: The service resource properties. - :paramtype properties: - ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResourceProperties - """ - super().__init__(location=location, tags=tags, **kwargs) - self.properties = properties - - -class ServiceResourceList(_serialization.Model): - """The list of service resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: - :vartype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :ivar next_link: URL to get the next set of service list results if there are any. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[ServiceResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.ServiceResource"]] = None, **kwargs: Any) -> None: - """ - :keyword value: - :paramtype value: list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class ServiceResourcePropertiesBase(_serialization.Model): - """The common service resource properties. - - :ivar placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :vartype placement_constraints: str - :ivar correlation_scheme: A list that describes the correlation of the service with other - services. - :vartype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric - objects. - :vartype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :ivar service_placement_policies: A list that describes the correlation of the service with - other services. - :vartype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :ivar scaling_policies: Scaling policies for this service. - :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - """ - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - } - - def __init__( - self, - *, - placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, - scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword placement_constraints: The placement constraints as a string. Placement constraints - are boolean expressions on node properties and allow for restricting a service to particular - nodes based on the service requirements. For example, to place a service on nodes where - NodeType is blue specify the following: "NodeColor == blue)". - :paramtype placement_constraints: str - :keyword correlation_scheme: A list that describes the correlation of the service with other - services. - :paramtype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :keyword service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetric objects. - :paramtype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :keyword service_placement_policies: A list that describes the correlation of the service with - other services. - :paramtype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :keyword scaling_policies: Scaling policies for this service. - :paramtype scaling_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - """ - super().__init__(**kwargs) - self.placement_constraints = placement_constraints - self.correlation_scheme = correlation_scheme - self.service_load_metrics = service_load_metrics - self.service_placement_policies = service_placement_policies - self.default_move_cost = default_move_cost - self.scaling_policies = scaling_policies - - -class ServiceResourceProperties(ServiceResourcePropertiesBase): - """The service resource properties. - - You probably want to use the sub-classes and not this class directly. Known sub-classes are: - StatefulServiceProperties, StatelessServiceProperties - - 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 placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :vartype placement_constraints: str - :ivar correlation_scheme: A list that describes the correlation of the service with other - services. - :vartype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric - objects. - :vartype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :ivar service_placement_policies: A list that describes the correlation of the service with - other services. - :vartype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :ivar scaling_policies: Scaling policies for this service. - :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :ivar service_kind: The kind of service (Stateless or Stateful). Required. Known values are: - "Stateless" and "Stateful". - :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind - :ivar service_type_name: The name of the service type. Required. - :vartype service_type_name: str - :ivar partition_description: Describes how the service is partitioned. Required. - :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Known values - are: "SharedProcess" and "ExclusiveProcess". - :vartype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name - can be used to return the IP addresses of service endpoints for application layer protocols - (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :vartype service_dns_name: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - "service_dns_name": {"key": "serviceDnsName", "type": "str"}, - } - - _subtype_map = { - "service_kind": {"Stateful": "StatefulServiceProperties", "Stateless": "StatelessServiceProperties"} - } - - def __init__( - self, - *, - service_type_name: str, - partition_description: "_models.Partition", - placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, - scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, - service_dns_name: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword placement_constraints: The placement constraints as a string. Placement constraints - are boolean expressions on node properties and allow for restricting a service to particular - nodes based on the service requirements. For example, to place a service on nodes where - NodeType is blue specify the following: "NodeColor == blue)". - :paramtype placement_constraints: str - :keyword correlation_scheme: A list that describes the correlation of the service with other - services. - :paramtype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :keyword service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetric objects. - :paramtype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :keyword service_placement_policies: A list that describes the correlation of the service with - other services. - :paramtype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :keyword scaling_policies: Scaling policies for this service. - :paramtype scaling_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :keyword service_type_name: The name of the service type. Required. - :paramtype service_type_name: str - :keyword partition_description: Describes how the service is partitioned. Required. - :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Known - values are: "SharedProcess" and "ExclusiveProcess". - :paramtype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :keyword service_dns_name: Dns name used for the service. If this is specified, then the DNS - name can be used to return the IP addresses of service endpoints for application layer - protocols (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :paramtype service_dns_name: str - """ - super().__init__( - placement_constraints=placement_constraints, - correlation_scheme=correlation_scheme, - service_load_metrics=service_load_metrics, - service_placement_policies=service_placement_policies, - default_move_cost=default_move_cost, - scaling_policies=scaling_policies, - **kwargs - ) - self.provisioning_state = None - self.service_kind: Optional[str] = None - self.service_type_name = service_type_name - self.partition_description = partition_description - self.service_package_activation_mode = service_package_activation_mode - self.service_dns_name = service_dns_name - - -class ServiceTypeHealthPolicy(_serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service - type. - - All required parameters must be populated in order to send to server. - - :ivar max_percent_unhealthy_services: The maximum allowed percentage of unhealthy services. - - The percentage represents the maximum tolerated percentage of services that can be unhealthy - before the application is considered in error. - If the percentage is respected but there is at least one unhealthy service, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy services of the specific service type - over the total number of services of the specific service type. - The computation rounds up to tolerate one failure on small numbers of services. Required. - :vartype max_percent_unhealthy_services: int - :ivar max_percent_unhealthy_partitions_per_service: The maximum allowed percentage of unhealthy - partitions per service. - - The percentage represents the maximum tolerated percentage of partitions that can be unhealthy - before the service is considered in error. - If the percentage is respected but there is at least one unhealthy partition, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy partitions over the total - number of partitions in the service. - The computation rounds up to tolerate one failure on small numbers of partitions. Required. - :vartype max_percent_unhealthy_partitions_per_service: int - :ivar max_percent_unhealthy_replicas_per_partition: The maximum allowed percentage of unhealthy - replicas per partition. - - The percentage represents the maximum tolerated percentage of replicas that can be unhealthy - before the partition is considered in error. - If the percentage is respected but there is at least one unhealthy replica, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy replicas over the total - number of replicas in the partition. - The computation rounds up to tolerate one failure on small numbers of replicas. Required. - :vartype max_percent_unhealthy_replicas_per_partition: int - """ - - _validation = { - "max_percent_unhealthy_services": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_unhealthy_partitions_per_service": {"required": True, "maximum": 100, "minimum": 0}, - "max_percent_unhealthy_replicas_per_partition": {"required": True, "maximum": 100, "minimum": 0}, - } - - _attribute_map = { - "max_percent_unhealthy_services": {"key": "maxPercentUnhealthyServices", "type": "int"}, - "max_percent_unhealthy_partitions_per_service": { - "key": "maxPercentUnhealthyPartitionsPerService", - "type": "int", - }, - "max_percent_unhealthy_replicas_per_partition": { - "key": "maxPercentUnhealthyReplicasPerPartition", - "type": "int", - }, - } - - def __init__( - self, - *, - max_percent_unhealthy_services: int, - max_percent_unhealthy_partitions_per_service: int, - max_percent_unhealthy_replicas_per_partition: int, - **kwargs: Any - ) -> None: - """ - :keyword max_percent_unhealthy_services: The maximum allowed percentage of unhealthy services. - - The percentage represents the maximum tolerated percentage of services that can be unhealthy - before the application is considered in error. - If the percentage is respected but there is at least one unhealthy service, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy services of the specific service type - over the total number of services of the specific service type. - The computation rounds up to tolerate one failure on small numbers of services. Required. - :paramtype max_percent_unhealthy_services: int - :keyword max_percent_unhealthy_partitions_per_service: The maximum allowed percentage of - unhealthy partitions per service. - - The percentage represents the maximum tolerated percentage of partitions that can be unhealthy - before the service is considered in error. - If the percentage is respected but there is at least one unhealthy partition, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy partitions over the total - number of partitions in the service. - The computation rounds up to tolerate one failure on small numbers of partitions. Required. - :paramtype max_percent_unhealthy_partitions_per_service: int - :keyword max_percent_unhealthy_replicas_per_partition: The maximum allowed percentage of - unhealthy replicas per partition. - - The percentage represents the maximum tolerated percentage of replicas that can be unhealthy - before the partition is considered in error. - If the percentage is respected but there is at least one unhealthy replica, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy replicas over the total - number of replicas in the partition. - The computation rounds up to tolerate one failure on small numbers of replicas. Required. - :paramtype max_percent_unhealthy_replicas_per_partition: int - """ - super().__init__(**kwargs) - self.max_percent_unhealthy_services = max_percent_unhealthy_services - self.max_percent_unhealthy_partitions_per_service = max_percent_unhealthy_partitions_per_service - self.max_percent_unhealthy_replicas_per_partition = max_percent_unhealthy_replicas_per_partition - - -class ServiceUpdateParameters(_serialization.Model): - """Service update request. - - :ivar tags: Service update parameters. - :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: Service update parameters. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class SettingsParameterDescription(_serialization.Model): - """Describes a parameter in fabric settings of the cluster. - - All required parameters must be populated in order to send to server. - - :ivar name: The parameter name of fabric setting. Required. - :vartype name: str - :ivar value: The parameter value of fabric setting. 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 parameter name of fabric setting. Required. - :paramtype name: str - :keyword value: The parameter value of fabric setting. Required. - :paramtype value: str - """ - super().__init__(**kwargs) - self.name = name - self.value = value - - -class SettingsSectionDescription(_serialization.Model): - """Describes a section in the fabric settings of the cluster. - - All required parameters must be populated in order to send to server. - - :ivar name: The section name of the fabric settings. Required. - :vartype name: str - :ivar parameters: The collection of parameters in the section. Required. - :vartype parameters: - list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsParameterDescription] - """ - - _validation = { - "name": {"required": True}, - "parameters": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "parameters": {"key": "parameters", "type": "[SettingsParameterDescription]"}, - } - - def __init__(self, *, name: str, parameters: List["_models.SettingsParameterDescription"], **kwargs: Any) -> None: - """ - :keyword name: The section name of the fabric settings. Required. - :paramtype name: str - :keyword parameters: The collection of parameters in the section. Required. - :paramtype parameters: - list[~azure.mgmt.servicefabricmanagedclusters.models.SettingsParameterDescription] - """ - super().__init__(**kwargs) - self.name = name - self.parameters = parameters - - -class SingletonPartitionScheme(Partition): - """SingletonPartitionScheme. - - All required parameters must be populated in order to send to server. - - :ivar partition_scheme: Specifies how the service is partitioned. Required. Known values are: - "Singleton", "UniformInt64Range", and "Named". - :vartype partition_scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme - """ - - _validation = { - "partition_scheme": {"required": True}, - } - - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.partition_scheme: str = "Singleton" - - -class Sku(_serialization.Model): - """Service Fabric managed cluster Sku definition. - - All required parameters must be populated in order to send to server. - - :ivar name: Sku Name. Required. Known values are: "Basic" and "Standard". - :vartype name: str or ~azure.mgmt.servicefabricmanagedclusters.models.SkuName - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: Union[str, "_models.SkuName"], **kwargs: Any) -> None: - """ - :keyword name: Sku Name. Required. Known values are: "Basic" and "Standard". - :paramtype name: str or ~azure.mgmt.servicefabricmanagedclusters.models.SkuName - """ - super().__init__(**kwargs) - self.name = name - - -class StatefulServiceProperties(ServiceResourceProperties): - """The properties of a stateful service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :vartype placement_constraints: str - :ivar correlation_scheme: A list that describes the correlation of the service with other - services. - :vartype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric - objects. - :vartype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :ivar service_placement_policies: A list that describes the correlation of the service with - other services. - :vartype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :ivar scaling_policies: Scaling policies for this service. - :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :ivar service_kind: The kind of service (Stateless or Stateful). Required. Known values are: - "Stateless" and "Stateful". - :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind - :ivar service_type_name: The name of the service type. Required. - :vartype service_type_name: str - :ivar partition_description: Describes how the service is partitioned. Required. - :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Known values - are: "SharedProcess" and "ExclusiveProcess". - :vartype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name - can be used to return the IP addresses of service endpoints for application layer protocols - (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :vartype service_dns_name: str - :ivar has_persisted_state: A flag indicating whether this is a persistent service which stores - states on the local disk. If it is then the value of this property is true, if not it is false. - :vartype has_persisted_state: bool - :ivar target_replica_set_size: The target replica set size as a number. - :vartype target_replica_set_size: int - :ivar min_replica_set_size: The minimum replica set size as a number. - :vartype min_replica_set_size: int - :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a - new replica is created, represented in ISO 8601 format "hh:mm:ss". - :vartype replica_restart_wait_duration: str - :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in - a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". - :vartype quorum_loss_wait_duration: str - :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format "hh:mm:ss". - :vartype stand_by_replica_keep_duration: str - :ivar service_placement_time_limit: The duration for which replicas can stay InBuild before - reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". - :vartype service_placement_time_limit: str - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - "target_replica_set_size": {"minimum": 1}, - "min_replica_set_size": {"minimum": 1}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - "service_dns_name": {"key": "serviceDnsName", "type": "str"}, - "has_persisted_state": {"key": "hasPersistedState", "type": "bool"}, - "target_replica_set_size": {"key": "targetReplicaSetSize", "type": "int"}, - "min_replica_set_size": {"key": "minReplicaSetSize", "type": "int"}, - "replica_restart_wait_duration": {"key": "replicaRestartWaitDuration", "type": "str"}, - "quorum_loss_wait_duration": {"key": "quorumLossWaitDuration", "type": "str"}, - "stand_by_replica_keep_duration": {"key": "standByReplicaKeepDuration", "type": "str"}, - "service_placement_time_limit": {"key": "servicePlacementTimeLimit", "type": "str"}, - } - - def __init__( - self, - *, - service_type_name: str, - partition_description: "_models.Partition", - placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, - scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, - service_dns_name: Optional[str] = None, - has_persisted_state: Optional[bool] = None, - target_replica_set_size: Optional[int] = None, - min_replica_set_size: Optional[int] = None, - replica_restart_wait_duration: Optional[str] = None, - quorum_loss_wait_duration: Optional[str] = None, - stand_by_replica_keep_duration: Optional[str] = None, - service_placement_time_limit: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword placement_constraints: The placement constraints as a string. Placement constraints - are boolean expressions on node properties and allow for restricting a service to particular - nodes based on the service requirements. For example, to place a service on nodes where - NodeType is blue specify the following: "NodeColor == blue)". - :paramtype placement_constraints: str - :keyword correlation_scheme: A list that describes the correlation of the service with other - services. - :paramtype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :keyword service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetric objects. - :paramtype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :keyword service_placement_policies: A list that describes the correlation of the service with - other services. - :paramtype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :keyword scaling_policies: Scaling policies for this service. - :paramtype scaling_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :keyword service_type_name: The name of the service type. Required. - :paramtype service_type_name: str - :keyword partition_description: Describes how the service is partitioned. Required. - :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Known - values are: "SharedProcess" and "ExclusiveProcess". - :paramtype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :keyword service_dns_name: Dns name used for the service. If this is specified, then the DNS - name can be used to return the IP addresses of service endpoints for application layer - protocols (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :paramtype service_dns_name: str - :keyword has_persisted_state: A flag indicating whether this is a persistent service which - stores states on the local disk. If it is then the value of this property is true, if not it is - false. - :paramtype has_persisted_state: bool - :keyword target_replica_set_size: The target replica set size as a number. - :paramtype target_replica_set_size: int - :keyword min_replica_set_size: The minimum replica set size as a number. - :paramtype min_replica_set_size: int - :keyword replica_restart_wait_duration: The duration between when a replica goes down and when - a new replica is created, represented in ISO 8601 format "hh:mm:ss". - :paramtype replica_restart_wait_duration: str - :keyword quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". - :paramtype quorum_loss_wait_duration: str - :keyword stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format "hh:mm:ss". - :paramtype stand_by_replica_keep_duration: str - :keyword service_placement_time_limit: The duration for which replicas can stay InBuild before - reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". - :paramtype service_placement_time_limit: str - """ - super().__init__( - placement_constraints=placement_constraints, - correlation_scheme=correlation_scheme, - service_load_metrics=service_load_metrics, - service_placement_policies=service_placement_policies, - default_move_cost=default_move_cost, - scaling_policies=scaling_policies, - service_type_name=service_type_name, - partition_description=partition_description, - service_package_activation_mode=service_package_activation_mode, - service_dns_name=service_dns_name, - **kwargs - ) - self.service_kind: str = "Stateful" - self.has_persisted_state = has_persisted_state - self.target_replica_set_size = target_replica_set_size - self.min_replica_set_size = min_replica_set_size - self.replica_restart_wait_duration = replica_restart_wait_duration - self.quorum_loss_wait_duration = quorum_loss_wait_duration - self.stand_by_replica_keep_duration = stand_by_replica_keep_duration - self.service_placement_time_limit = service_placement_time_limit - - -class StatelessServiceProperties(ServiceResourceProperties): - """The properties of a stateless service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :vartype placement_constraints: str - :ivar correlation_scheme: A list that describes the correlation of the service with other - services. - :vartype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric - objects. - :vartype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :ivar service_placement_policies: A list that describes the correlation of the service with - other services. - :vartype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :vartype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :ivar scaling_policies: Scaling policies for this service. - :vartype scaling_policies: list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :ivar service_kind: The kind of service (Stateless or Stateful). Required. Known values are: - "Stateless" and "Stateful". - :vartype service_kind: str or ~azure.mgmt.servicefabricmanagedclusters.models.ServiceKind - :ivar service_type_name: The name of the service type. Required. - :vartype service_type_name: str - :ivar partition_description: Describes how the service is partitioned. Required. - :vartype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :ivar service_package_activation_mode: The activation Mode of the service package. Known values - are: "SharedProcess" and "ExclusiveProcess". - :vartype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :ivar service_dns_name: Dns name used for the service. If this is specified, then the DNS name - can be used to return the IP addresses of service endpoints for application layer protocols - (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :vartype service_dns_name: str - :ivar instance_count: The instance count. Required. - :vartype instance_count: int - :ivar min_instance_count: MinInstanceCount is the minimum number of instances that must be up - to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. - The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * - InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 - is first converted into the number of nodes on which the instances are allowed to be placed - according to the placement constraints on the service. - :vartype min_instance_count: int - :ivar min_instance_percentage: MinInstancePercentage is the minimum percentage of InstanceCount - that must be up to meet the EnsureAvailability safety check during operations like upgrade or - deactivate node. The actual number that is used is max( MinInstanceCount, ceil( - MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during - MinInstancePercentage computation, -1 is first converted into the number of nodes on which the - instances are allowed to be placed according to the placement constraints on the service. - :vartype min_instance_percentage: int - """ - - _validation = { - "provisioning_state": {"readonly": True}, - "service_kind": {"required": True}, - "service_type_name": {"required": True}, - "partition_description": {"required": True}, - "instance_count": {"required": True, "minimum": -1}, - } - - _attribute_map = { - "placement_constraints": {"key": "placementConstraints", "type": "str"}, - "correlation_scheme": {"key": "correlationScheme", "type": "[ServiceCorrelation]"}, - "service_load_metrics": {"key": "serviceLoadMetrics", "type": "[ServiceLoadMetric]"}, - "service_placement_policies": {"key": "servicePlacementPolicies", "type": "[ServicePlacementPolicy]"}, - "default_move_cost": {"key": "defaultMoveCost", "type": "str"}, - "scaling_policies": {"key": "scalingPolicies", "type": "[ScalingPolicy]"}, - "provisioning_state": {"key": "provisioningState", "type": "str"}, - "service_kind": {"key": "serviceKind", "type": "str"}, - "service_type_name": {"key": "serviceTypeName", "type": "str"}, - "partition_description": {"key": "partitionDescription", "type": "Partition"}, - "service_package_activation_mode": {"key": "servicePackageActivationMode", "type": "str"}, - "service_dns_name": {"key": "serviceDnsName", "type": "str"}, - "instance_count": {"key": "instanceCount", "type": "int"}, - "min_instance_count": {"key": "minInstanceCount", "type": "int"}, - "min_instance_percentage": {"key": "minInstancePercentage", "type": "int"}, - } - - def __init__( - self, - *, - service_type_name: str, - partition_description: "_models.Partition", - instance_count: int, - placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["_models.ServiceCorrelation"]] = None, - service_load_metrics: Optional[List["_models.ServiceLoadMetric"]] = None, - service_placement_policies: Optional[List["_models.ServicePlacementPolicy"]] = None, - default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, - scaling_policies: Optional[List["_models.ScalingPolicy"]] = None, - service_package_activation_mode: Optional[Union[str, "_models.ServicePackageActivationMode"]] = None, - service_dns_name: Optional[str] = None, - min_instance_count: Optional[int] = None, - min_instance_percentage: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword placement_constraints: The placement constraints as a string. Placement constraints - are boolean expressions on node properties and allow for restricting a service to particular - nodes based on the service requirements. For example, to place a service on nodes where - NodeType is blue specify the following: "NodeColor == blue)". - :paramtype placement_constraints: str - :keyword correlation_scheme: A list that describes the correlation of the service with other - services. - :paramtype correlation_scheme: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceCorrelation] - :keyword service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetric objects. - :paramtype service_load_metrics: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServiceLoadMetric] - :keyword service_placement_policies: A list that describes the correlation of the service with - other services. - :paramtype service_placement_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ServicePlacementPolicy] - :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", - "Low", "Medium", and "High". - :paramtype default_move_cost: str or ~azure.mgmt.servicefabricmanagedclusters.models.MoveCost - :keyword scaling_policies: Scaling policies for this service. - :paramtype scaling_policies: - list[~azure.mgmt.servicefabricmanagedclusters.models.ScalingPolicy] - :keyword service_type_name: The name of the service type. Required. - :paramtype service_type_name: str - :keyword partition_description: Describes how the service is partitioned. Required. - :paramtype partition_description: ~azure.mgmt.servicefabricmanagedclusters.models.Partition - :keyword service_package_activation_mode: The activation Mode of the service package. Known - values are: "SharedProcess" and "ExclusiveProcess". - :paramtype service_package_activation_mode: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ServicePackageActivationMode - :keyword service_dns_name: Dns name used for the service. If this is specified, then the DNS - name can be used to return the IP addresses of service endpoints for application layer - protocols (e.g., HTTP). - When updating serviceDnsName, old name may be temporarily resolvable. However, rely on new - name. - When removing serviceDnsName, removed name may temporarily be resolvable. Do not rely on the - name being unresolvable. - :paramtype service_dns_name: str - :keyword instance_count: The instance count. Required. - :paramtype instance_count: int - :keyword min_instance_count: MinInstanceCount is the minimum number of instances that must be - up to meet the EnsureAvailability safety check during operations like upgrade or deactivate - node. The actual number that is used is max( MinInstanceCount, ceil( - MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during - MinInstanceCount computation -1 is first converted into the number of nodes on which the - instances are allowed to be placed according to the placement constraints on the service. - :paramtype min_instance_count: int - :keyword min_instance_percentage: MinInstancePercentage is the minimum percentage of - InstanceCount that must be up to meet the EnsureAvailability safety check during operations - like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( - MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during - MinInstancePercentage computation, -1 is first converted into the number of nodes on which the - instances are allowed to be placed according to the placement constraints on the service. - :paramtype min_instance_percentage: int - """ - super().__init__( - placement_constraints=placement_constraints, - correlation_scheme=correlation_scheme, - service_load_metrics=service_load_metrics, - service_placement_policies=service_placement_policies, - default_move_cost=default_move_cost, - scaling_policies=scaling_policies, - service_type_name=service_type_name, - partition_description=partition_description, - service_package_activation_mode=service_package_activation_mode, - service_dns_name=service_dns_name, - **kwargs - ) - self.service_kind: str = "Stateless" - self.instance_count = instance_count - self.min_instance_count = min_instance_count - self.min_instance_percentage = min_instance_percentage - - -class Subnet(_serialization.Model): - """Describes a Subnet. - - All required parameters must be populated in order to send to server. - - :ivar name: Subnet name. Required. - :vartype name: str - :ivar enable_ipv6: Indicates wether to enable Ipv6 or not. If not provided, it will take the - same configuration as the cluster. - :vartype enable_ipv6: bool - :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Known values are: "enabled" and "disabled". - :vartype private_endpoint_network_policies: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies - :ivar private_link_service_network_policies: Enable or Disable apply network policies on - private link service in the subnet. Known values are: "enabled" and "disabled". - :vartype private_link_service_network_policies: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies - :ivar network_security_group_id: Full resource id for the network security group. - :vartype network_security_group_id: str - """ - - _validation = { - "name": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "enable_ipv6": {"key": "enableIpv6", "type": "bool"}, - "private_endpoint_network_policies": {"key": "privateEndpointNetworkPolicies", "type": "str"}, - "private_link_service_network_policies": {"key": "privateLinkServiceNetworkPolicies", "type": "str"}, - "network_security_group_id": {"key": "networkSecurityGroupId", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - enable_ipv6: Optional[bool] = None, - private_endpoint_network_policies: Optional[Union[str, "_models.PrivateEndpointNetworkPolicies"]] = None, - private_link_service_network_policies: Optional[Union[str, "_models.PrivateLinkServiceNetworkPolicies"]] = None, - network_security_group_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: Subnet name. Required. - :paramtype name: str - :keyword enable_ipv6: Indicates wether to enable Ipv6 or not. If not provided, it will take the - same configuration as the cluster. - :paramtype enable_ipv6: bool - :keyword private_endpoint_network_policies: Enable or Disable apply network policies on private - end point in the subnet. Known values are: "enabled" and "disabled". - :paramtype private_endpoint_network_policies: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateEndpointNetworkPolicies - :keyword private_link_service_network_policies: Enable or Disable apply network policies on - private link service in the subnet. Known values are: "enabled" and "disabled". - :paramtype private_link_service_network_policies: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PrivateLinkServiceNetworkPolicies - :keyword network_security_group_id: Full resource id for the network security group. - :paramtype network_security_group_id: str - """ - super().__init__(**kwargs) - self.name = name - self.enable_ipv6 = enable_ipv6 - self.private_endpoint_network_policies = private_endpoint_network_policies - self.private_link_service_network_policies = private_link_service_network_policies - self.network_security_group_id = network_security_group_id - - -class SubResource(_serialization.Model): - """Azure resource identifier. - - :ivar id: Azure resource identifier. - :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: Azure resource identifier. - :paramtype id: str - """ - super().__init__(**kwargs) - self.id = id - - -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. - :vartype created_by_type: str - :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. - :vartype last_modified_by_type: str - :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[str] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[str] = 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. - :paramtype created_by_type: str - :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. - :paramtype last_modified_by_type: str - :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 UniformInt64RangePartitionScheme(Partition): - """Describes a partitioning scheme where an integer range is allocated evenly across a number of - partitions. - - All required parameters must be populated in order to send to server. - - :ivar partition_scheme: Specifies how the service is partitioned. Required. Known values are: - "Singleton", "UniformInt64Range", and "Named". - :vartype partition_scheme: str or - ~azure.mgmt.servicefabricmanagedclusters.models.PartitionScheme - :ivar count: The number of partitions. Required. - :vartype count: int - :ivar low_key: The lower bound of the partition key range that - should be split between the partition ‘Count’. Required. - :vartype low_key: int - :ivar high_key: The upper bound of the partition key range that - should be split between the partition ‘Count’. Required. - :vartype high_key: int - """ - - _validation = { - "partition_scheme": {"required": True}, - "count": {"required": True}, - "low_key": {"required": True}, - "high_key": {"required": True}, - } - - _attribute_map = { - "partition_scheme": {"key": "partitionScheme", "type": "str"}, - "count": {"key": "count", "type": "int"}, - "low_key": {"key": "lowKey", "type": "int"}, - "high_key": {"key": "highKey", "type": "int"}, - } - - def __init__(self, *, count: int, low_key: int, high_key: int, **kwargs: Any) -> None: - """ - :keyword count: The number of partitions. Required. - :paramtype count: int - :keyword low_key: The lower bound of the partition key range that - should be split between the partition ‘Count’. Required. - :paramtype low_key: int - :keyword high_key: The upper bound of the partition key range that - should be split between the partition ‘Count’. Required. - :paramtype high_key: int - """ - super().__init__(**kwargs) - self.partition_scheme: str = "UniformInt64Range" - self.count = count - self.low_key = low_key - self.high_key = high_key - - -class UserAssignedIdentity(_serialization.Model): - """UserAssignedIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class VaultCertificate(_serialization.Model): - """Describes a single certificate reference in a Key Vault, and where the certificate should - reside on the VM. - - All required parameters must be populated in order to send to server. - - :ivar certificate_url: This is the URL of a certificate that has been uploaded to Key Vault as - a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault - `_. Required. - :vartype certificate_url: str - :ivar certificate_store: For Windows VMs, specifies the certificate store on the Virtual - Machine to which the certificate should be added. The specified certificate store is implicitly - in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate file is - placed under the /var/lib/waagent directory, with the file name - :code:``.crt for the X509 certificate file and - :code:``.prv for private key. Both of these files are .pem formatted. - Required. - :vartype certificate_store: str - """ - - _validation = { - "certificate_url": {"required": True}, - "certificate_store": {"required": True}, - } - - _attribute_map = { - "certificate_url": {"key": "certificateUrl", "type": "str"}, - "certificate_store": {"key": "certificateStore", "type": "str"}, - } - - def __init__(self, *, certificate_url: str, certificate_store: str, **kwargs: Any) -> None: - """ - :keyword certificate_url: This is the URL of a certificate that has been uploaded to Key Vault - as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key vault - `_. Required. - :paramtype certificate_url: str - :keyword certificate_store: For Windows VMs, specifies the certificate store on the Virtual - Machine to which the certificate should be added. The specified certificate store is implicitly - in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate file is - placed under the /var/lib/waagent directory, with the file name - :code:``.crt for the X509 certificate file and - :code:``.prv for private key. Both of these files are .pem formatted. - Required. - :paramtype certificate_store: str - """ - super().__init__(**kwargs) - self.certificate_url = certificate_url - self.certificate_store = certificate_store - - -class VaultSecretGroup(_serialization.Model): - """Specifies set of certificates that should be installed onto the virtual machines. - - All required parameters must be populated in order to send to server. - - :ivar source_vault: The relative URL of the Key Vault containing all of the certificates in - VaultCertificates. Required. - :vartype source_vault: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :ivar vault_certificates: The list of key vault references in SourceVault which contain - certificates. Required. - :vartype vault_certificates: - list[~azure.mgmt.servicefabricmanagedclusters.models.VaultCertificate] - """ - - _validation = { - "source_vault": {"required": True}, - "vault_certificates": {"required": True}, - } - - _attribute_map = { - "source_vault": {"key": "sourceVault", "type": "SubResource"}, - "vault_certificates": {"key": "vaultCertificates", "type": "[VaultCertificate]"}, - } - - def __init__( - self, - *, - source_vault: "_models.SubResource", - vault_certificates: List["_models.VaultCertificate"], - **kwargs: Any - ) -> None: - """ - :keyword source_vault: The relative URL of the Key Vault containing all of the certificates in - VaultCertificates. Required. - :paramtype source_vault: ~azure.mgmt.servicefabricmanagedclusters.models.SubResource - :keyword vault_certificates: The list of key vault references in SourceVault which contain - certificates. Required. - :paramtype vault_certificates: - list[~azure.mgmt.servicefabricmanagedclusters.models.VaultCertificate] - """ - super().__init__(**kwargs) - self.source_vault = source_vault - self.vault_certificates = vault_certificates - - -class VmApplication(_serialization.Model): - """Specifies the gallery application that should be made available to the underlying VMSS. - - All required parameters must be populated in order to send to server. - - :ivar configuration_reference: Optional, Specifies the uri to an azure blob that will replace - the default configuration for the package if provided. - :vartype configuration_reference: str - :ivar enable_automatic_upgrade: If set to true, when a new Gallery Application version is - available in PIR/SIG, it will be automatically updated for the underlying VMSS. - :vartype enable_automatic_upgrade: bool - :ivar order: Optional, Specifies the order in which the packages have to be installed. - :vartype order: int - :ivar package_reference_id: Specifies the GalleryApplicationVersion resource id on the form of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long - Required. - :vartype package_reference_id: str - :ivar vm_gallery_tags: Optional, Specifies a passthrough value for more generic context. - Accepts a JSON-formatted string e.g. '{"Tag1":"Value1","Tag2":"Value2"}'. - :vartype vm_gallery_tags: str - :ivar treat_failure_as_deployment_failure: Optional, If true, any failure for any operation in - the VmApplication will fail the deployment. - :vartype treat_failure_as_deployment_failure: bool - """ - - _validation = { - "package_reference_id": {"required": True}, - } - - _attribute_map = { - "configuration_reference": {"key": "configurationReference", "type": "str"}, - "enable_automatic_upgrade": {"key": "enableAutomaticUpgrade", "type": "bool"}, - "order": {"key": "order", "type": "int"}, - "package_reference_id": {"key": "packageReferenceId", "type": "str"}, - "vm_gallery_tags": {"key": "vmGalleryTags", "type": "str"}, - "treat_failure_as_deployment_failure": {"key": "treatFailureAsDeploymentFailure", "type": "bool"}, - } - - def __init__( - self, - *, - package_reference_id: str, - configuration_reference: Optional[str] = None, - enable_automatic_upgrade: Optional[bool] = None, - order: Optional[int] = None, - vm_gallery_tags: Optional[str] = None, - treat_failure_as_deployment_failure: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword configuration_reference: Optional, Specifies the uri to an azure blob that will - replace the default configuration for the package if provided. - :paramtype configuration_reference: str - :keyword enable_automatic_upgrade: If set to true, when a new Gallery Application version is - available in PIR/SIG, it will be automatically updated for the underlying VMSS. - :paramtype enable_automatic_upgrade: bool - :keyword order: Optional, Specifies the order in which the packages have to be installed. - :paramtype order: int - :keyword package_reference_id: Specifies the GalleryApplicationVersion resource id on the form - of - /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{application}/versions/{version}. # pylint: disable=line-too-long - Required. - :paramtype package_reference_id: str - :keyword vm_gallery_tags: Optional, Specifies a passthrough value for more generic context. - Accepts a JSON-formatted string e.g. '{"Tag1":"Value1","Tag2":"Value2"}'. - :paramtype vm_gallery_tags: str - :keyword treat_failure_as_deployment_failure: Optional, If true, any failure for any operation - in the VmApplication will fail the deployment. - :paramtype treat_failure_as_deployment_failure: bool - """ - super().__init__(**kwargs) - self.configuration_reference = configuration_reference - self.enable_automatic_upgrade = enable_automatic_upgrade - self.order = order - self.package_reference_id = package_reference_id - self.vm_gallery_tags = vm_gallery_tags - self.treat_failure_as_deployment_failure = treat_failure_as_deployment_failure - - -class VmImagePlan(_serialization.Model): - """Specifies information about the marketplace image used to create the virtual machine. This - element is only used for marketplace images. Before you can use a marketplace image from an - API, you must enable the image for programmatic use. In the Azure portal, find the marketplace - image that you want to use and then click Want to deploy programmatically, Get Started ->. - Enter any required information and then click Save. - - :ivar name: The plan ID. - :vartype name: str - :ivar product: Specifies the product of the image from the marketplace. This is the same value - as Offer under the imageReference element. - :vartype product: str - :ivar promotion_code: The promotion code. - :vartype promotion_code: str - :ivar publisher: The publisher ID. - :vartype publisher: str - """ - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "product": {"key": "product", "type": "str"}, - "promotion_code": {"key": "promotionCode", "type": "str"}, - "publisher": {"key": "publisher", "type": "str"}, - } - - def __init__( - self, - *, - name: Optional[str] = None, - product: Optional[str] = None, - promotion_code: Optional[str] = None, - publisher: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The plan ID. - :paramtype name: str - :keyword product: Specifies the product of the image from the marketplace. This is the same - value as Offer under the imageReference element. - :paramtype product: str - :keyword promotion_code: The promotion code. - :paramtype promotion_code: str - :keyword publisher: The publisher ID. - :paramtype publisher: str - """ - super().__init__(**kwargs) - self.name = name - self.product = product - self.promotion_code = promotion_code - self.publisher = publisher - - -class VmManagedIdentity(_serialization.Model): - """Identities for the virtual machine scale set under the node type. - - :ivar user_assigned_identities: The list of user identities associated with the virtual machine - scale set under the node type. Each entry will be an ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :vartype user_assigned_identities: list[str] - """ - - _attribute_map = { - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "[str]"}, - } - - def __init__(self, *, user_assigned_identities: Optional[List[str]] = None, **kwargs: Any) -> None: - """ - :keyword user_assigned_identities: The list of user identities associated with the virtual - machine scale set under the node type. Each entry will be an ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. # pylint: disable=line-too-long - :paramtype user_assigned_identities: list[str] - """ - super().__init__(**kwargs) - self.user_assigned_identities = user_assigned_identities - - -class VMSize(_serialization.Model): - """VM Sizes properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar size: VM Size name. - :vartype size: str - """ - - _validation = { - "size": {"readonly": True}, - } - - _attribute_map = { - "size": {"key": "size", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.size = None - - -class VmssDataDisk(_serialization.Model): - """Managed data disk description. - - All required parameters must be populated in order to send to server. - - :ivar lun: Specifies the logical unit number of the data disk. This value is used to identify - data disks within the VM and therefore must be unique for each data disk attached to a VM. Lun - 0 is reserved for the service fabric data disk. Required. - :vartype lun: int - :ivar disk_size_gb: Disk size for each vm in the node type in GBs. Required. - :vartype disk_size_gb: int - :ivar disk_type: Managed data disk type. Specifies the storage account type for the managed - disk. Known values are: "Standard_LRS", "StandardSSD_LRS", and "Premium_LRS". - :vartype disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType - :ivar disk_letter: Managed data disk letter. It can not use the reserved letter C or D and it - can not change after created. Required. - :vartype disk_letter: str - """ - - _validation = { - "lun": {"required": True, "minimum": 1}, - "disk_size_gb": {"required": True}, - "disk_type": {"required": True}, - "disk_letter": {"required": True, "pattern": r"^[a-zA-Z]{1}$"}, - } - - _attribute_map = { - "lun": {"key": "lun", "type": "int"}, - "disk_size_gb": {"key": "diskSizeGB", "type": "int"}, - "disk_type": {"key": "diskType", "type": "str"}, - "disk_letter": {"key": "diskLetter", "type": "str"}, - } - - def __init__( - self, - *, - lun: int, - disk_size_gb: int, - disk_type: Union[str, "_models.DiskType"] = "StandardSSD_LRS", - disk_letter: str, - **kwargs: Any - ) -> None: - """ - :keyword lun: Specifies the logical unit number of the data disk. This value is used to - identify data disks within the VM and therefore must be unique for each data disk attached to a - VM. Lun 0 is reserved for the service fabric data disk. Required. - :paramtype lun: int - :keyword disk_size_gb: Disk size for each vm in the node type in GBs. Required. - :paramtype disk_size_gb: int - :keyword disk_type: Managed data disk type. Specifies the storage account type for the managed - disk. Known values are: "Standard_LRS", "StandardSSD_LRS", and "Premium_LRS". - :paramtype disk_type: str or ~azure.mgmt.servicefabricmanagedclusters.models.DiskType - :keyword disk_letter: Managed data disk letter. It can not use the reserved letter C or D and - it can not change after created. Required. - :paramtype disk_letter: str - """ - super().__init__(**kwargs) - self.lun = lun - self.disk_size_gb = disk_size_gb - self.disk_type = disk_type - self.disk_letter = disk_letter - - -class VMSSExtension(_serialization.Model): - """Specifies set of extensions that should be installed onto the virtual machines. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the extension. Required. - :vartype name: str - :ivar publisher: The name of the extension handler publisher. Required. - :vartype publisher: str - :ivar type: Specifies the type of the extension; an example is "CustomScriptExtension". - Required. - :vartype type: str - :ivar type_handler_version: Specifies the version of the script handler. Required. - :vartype type_handler_version: str - :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: JSON - :ivar protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :vartype protected_settings: JSON - :ivar force_update_tag: If a value is provided and is different from the previous value, the - extension handler will be forced to update even if the extension configuration has not changed. - :vartype force_update_tag: str - :ivar provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :vartype provision_after_extensions: list[str] - :ivar provisioning_state: The provisioning state, which only appears in the response. - :vartype provisioning_state: str - :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version of the extension available. - :vartype enable_automatic_upgrade: bool - :ivar setup_order: Indicates the setup order for the extension. - :vartype setup_order: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder] - """ - - _validation = { - "name": {"required": True}, - "publisher": {"required": True}, - "type": {"required": True}, - "type_handler_version": {"required": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "publisher": {"key": "properties.publisher", "type": "str"}, - "type": {"key": "properties.type", "type": "str"}, - "type_handler_version": {"key": "properties.typeHandlerVersion", "type": "str"}, - "auto_upgrade_minor_version": {"key": "properties.autoUpgradeMinorVersion", "type": "bool"}, - "settings": {"key": "properties.settings", "type": "object"}, - "protected_settings": {"key": "properties.protectedSettings", "type": "object"}, - "force_update_tag": {"key": "properties.forceUpdateTag", "type": "str"}, - "provision_after_extensions": {"key": "properties.provisionAfterExtensions", "type": "[str]"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "enable_automatic_upgrade": {"key": "properties.enableAutomaticUpgrade", "type": "bool"}, - "setup_order": {"key": "properties.setupOrder", "type": "[str]"}, - } - - def __init__( - self, - *, - name: str, - publisher: str, - type: str, - type_handler_version: str, - auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[JSON] = None, - protected_settings: Optional[JSON] = None, - force_update_tag: Optional[str] = None, - provision_after_extensions: Optional[List[str]] = None, - enable_automatic_upgrade: Optional[bool] = None, - setup_order: Optional[List[Union[str, "_models.VmssExtensionSetupOrder"]]] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the extension. Required. - :paramtype name: str - :keyword publisher: The name of the extension handler publisher. Required. - :paramtype publisher: str - :keyword type: Specifies the type of the extension; an example is "CustomScriptExtension". - Required. - :paramtype type: str - :keyword type_handler_version: Specifies the version of the script handler. Required. - :paramtype type_handler_version: str - :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: JSON - :keyword protected_settings: The extension can contain either protectedSettings or - protectedSettingsFromKeyVault or no protected settings at all. - :paramtype protected_settings: JSON - :keyword force_update_tag: If a value is provided and is different from the previous value, the - extension handler will be forced to update even if the extension configuration has not changed. - :paramtype force_update_tag: str - :keyword provision_after_extensions: Collection of extension names after which this extension - needs to be provisioned. - :paramtype provision_after_extensions: list[str] - :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically - upgraded by the platform if there is a newer version of the extension available. - :paramtype enable_automatic_upgrade: bool - :keyword setup_order: Indicates the setup order for the extension. - :paramtype setup_order: list[str or - ~azure.mgmt.servicefabricmanagedclusters.models.VmssExtensionSetupOrder] - """ - super().__init__(**kwargs) - self.name = name - self.publisher = publisher - self.type = type - self.type_handler_version = type_handler_version - self.auto_upgrade_minor_version = auto_upgrade_minor_version - self.settings = settings - self.protected_settings = protected_settings - self.force_update_tag = force_update_tag - self.provision_after_extensions = provision_after_extensions - self.provisioning_state = None - self.enable_automatic_upgrade = enable_automatic_upgrade - self.setup_order = setup_order diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# 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 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py index 87179ac04eb7..1e2afebaee4f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,42 +12,42 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._application_types_operations import ApplicationTypesOperations # type: ignore -from ._application_type_versions_operations import ApplicationTypeVersionsOperations # type: ignore -from ._applications_operations import ApplicationsOperations # type: ignore -from ._services_operations import ServicesOperations # type: ignore -from ._managed_clusters_operations import ManagedClustersOperations # type: ignore -from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations # type: ignore -from ._managed_maintenance_window_status_operations import ManagedMaintenanceWindowStatusOperations # type: ignore -from ._managed_apply_maintenance_window_operations import ManagedApplyMaintenanceWindowOperations # type: ignore -from ._managed_cluster_version_operations import ManagedClusterVersionOperations # type: ignore -from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations # type: ignore -from ._operation_status_operations import OperationStatusOperations # type: ignore -from ._operation_results_operations import OperationResultsOperations # type: ignore from ._operations import Operations # type: ignore -from ._node_types_operations import NodeTypesOperations # type: ignore -from ._node_type_skus_operations import NodeTypeSkusOperations # type: ignore +from ._operations import ApplicationsOperations # type: ignore +from ._operations import ApplicationTypesOperations # type: ignore +from ._operations import ApplicationTypeVersionsOperations # type: ignore +from ._operations import ServicesOperations # type: ignore +from ._operations import ManagedClusterVersionOperations # type: ignore +from ._operations import ManagedUnsupportedVMSizesOperations # type: ignore +from ._operations import ManagedClustersOperations # type: ignore +from ._operations import ManagedAzResiliencyStatusOperations # type: ignore +from ._operations import ManagedApplyMaintenanceWindowOperations # type: ignore +from ._operations import ManagedMaintenanceWindowStatusOperations # type: ignore +from ._operations import NodeTypesOperations # type: ignore +from ._operations import NodeTypeSkusOperations # type: ignore +from ._operations import OperationResultsOperations # type: ignore +from ._operations import OperationStatusOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __all__ = [ + "Operations", + "ApplicationsOperations", "ApplicationTypesOperations", "ApplicationTypeVersionsOperations", - "ApplicationsOperations", "ServicesOperations", + "ManagedClusterVersionOperations", + "ManagedUnsupportedVMSizesOperations", "ManagedClustersOperations", "ManagedAzResiliencyStatusOperations", - "ManagedMaintenanceWindowStatusOperations", "ManagedApplyMaintenanceWindowOperations", - "ManagedClusterVersionOperations", - "ManagedUnsupportedVMSizesOperations", - "OperationStatusOperations", - "OperationResultsOperations", - "Operations", + "ManagedMaintenanceWindowStatusOperations", "NodeTypesOperations", "NodeTypeSkusOperations", + "OperationResultsOperations", + "OperationStatusOperations", ] __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore _patch_sdk() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py deleted file mode 100644 index 999d5647eb5f..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py +++ /dev/null @@ -1,929 +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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, - cluster_name: str, - application_type_name: 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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_create_or_update_request( - resource_group_name: str, - cluster_name: str, - application_type_name: 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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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 - 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, - cluster_name: str, - application_type_name: 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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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 - 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, - cluster_name: str, - application_type_name: 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_application_types_request( - resource_group_name: str, cluster_name: str, application_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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 ApplicationTypeVersionsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`application_type_versions` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Gets a Service Fabric managed application type version resource. - - Get a Service Fabric managed application type version resource created or in the process of - being created in the Service Fabric managed application type name resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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.ApplicationTypeVersionResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeVersionResource", 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, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionResource, 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, "ApplicationTypeVersionResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_type_name: str, - version: str, - parameters: _models.ApplicationTypeVersionResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationTypeVersionResource]: - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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 ApplicationTypeVersionResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationTypeVersionResource]: - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. 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 ApplicationTypeVersionResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationTypeVersionResource]: - """Creates or updates a Service Fabric managed application type version resource. - - Create or update a Service Fabric managed application type version resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource. Is either a - ApplicationTypeVersionResource type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource or IO[bytes] - :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the - result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :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.ApplicationTypeVersionResource] = 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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("ApplicationTypeVersionResource", 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.ApplicationTypeVersionResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationTypeVersionResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: _models.ApplicationTypeVersionUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - version: str, - parameters: Union[_models.ApplicationTypeVersionUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeVersionResource: - """Updates the tags of an application type version resource of a given managed cluster. - - Updates the tags of an application type version resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: str - :param parameters: The application type version resource updated tags. Is either a - ApplicationTypeVersionUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters or - IO[bytes] - :return: ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource - :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.ApplicationTypeVersionResource] = 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, "ApplicationTypeVersionUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeVersionResource", 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, cluster_name: str, application_type_name: str, version: 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_type_name: str, version: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Service Fabric managed application type version resource. - - Delete a Service Fabric managed application type version resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param version: The application type version. Required. - :type version: 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, - cluster_name=cluster_name, - application_type_name=application_type_name, - version=version, - 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 list_by_application_types( - self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationTypeVersionResource"]: - """Gets the list of application type version resources created in the specified Service Fabric - managed application type name resource. - - Gets all application type version resources created or in the process of being created in the - Service Fabric managed application type name resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :return: An iterator like instance of either ApplicationTypeVersionResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] - :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.ApplicationTypeVersionResourceList] = 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_application_types_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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("ApplicationTypeVersionResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py deleted file mode 100644 index 889f5eb05993..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py +++ /dev/null @@ -1,785 +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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, cluster_name: str, application_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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, cluster_name: str, application_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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, cluster_name: str, application_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_delete_request( - resource_group_name: str, cluster_name: str, application_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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 ApplicationTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`application_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Gets a Service Fabric managed application type name resource. - - Get a Service Fabric application type name resource created or in the process of being created - in the Service Fabric managed cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, - cluster_name: str, - application_type_name: str, - parameters: _models.ApplicationTypeResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. 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: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: Union[_models.ApplicationTypeResource, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Creates or updates a Service Fabric managed application type name resource. - - Create or update a Service Fabric managed application type name resource with the specified - name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type name resource. Is either a ApplicationTypeResource type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource or - IO[bytes] - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = 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, "ApplicationTypeResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, - cluster_name: str, - application_type_name: str, - parameters: _models.ApplicationTypeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. 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: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_name: str, - application_type_name: str, - parameters: Union[_models.ApplicationTypeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationTypeResource: - """Updates the tags of an application type resource of a given managed cluster. - - Updates the tags of an application type resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_name: str - :param parameters: The application type resource updated tags. Is either a - ApplicationTypeUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters or IO[bytes] - :return: ApplicationTypeResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource - :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.ApplicationTypeResource] = 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, "ApplicationTypeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationTypeResource", 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, cluster_name: str, application_type_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, - cluster_name=cluster_name, - application_type_name=application_type_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.ErrorModel, 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, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Service Fabric managed application type name resource. - - Delete a Service Fabric managed application type name resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_type_name: The name of the application type name resource. Required. - :type application_type_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, - cluster_name=cluster_name, - application_type_name=application_type_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 list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationTypeResource"]: - """Gets the list of application type name resources created in the specified Service Fabric - managed cluster resource. - - Gets all application type name resources created or in the process of being created in the - Service Fabric managed cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either ApplicationTypeResource or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] - :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.ApplicationTypeResourceList] = 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, - cluster_name=cluster_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("ApplicationTypeResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py deleted file mode 100644 index 9aaacba597d4..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py +++ /dev/null @@ -1,1418 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_read_upgrade_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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_start_rollback_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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_resume_upgrade_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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_get_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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, cluster_name: str, application_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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, cluster_name: str, application_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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_delete_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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 ApplicationsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`applications` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - def _read_upgrade_initial( - self, resource_group_name: str, cluster_name: str, application_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_read_upgrade_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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]: - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_read_upgrade( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Get the status of the latest application upgrade. - - Get the status of the latest application upgrade. It will query the cluster to find the status - of the latest application upgrade. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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._read_upgrade_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_rollback_initial( - self, resource_group_name: str, cluster_name: str, application_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_start_rollback_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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]: - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_start_rollback( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Send a request to start a rollback of the current application upgrade. - - Send a request to start a rollback of the current application upgrade. This will start rolling - back the application to the previous version. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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._start_rollback_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _resume_upgrade_initial( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, 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, "RuntimeResumeApplicationUpgradeParameters") - - _request = build_resume_upgrade_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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 [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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - 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_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: _models.RuntimeResumeApplicationUpgradeParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters - :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_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_resume_upgrade( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Send a request to resume the current application upgrade. - - Send a request to resume the current application upgrade. This will resume the application - upgrade from where it was paused. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The parameters for resuming an application upgrade. Is either a - RuntimeResumeApplicationUpgradeParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters 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._resume_upgrade_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> _models.ApplicationResource: - """Gets a Service Fabric managed application resource. - - Get a Service Fabric managed application resource created or in the process of being created in - the Service Fabric cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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.ApplicationResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationResource", 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, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationResource, 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, "ApplicationResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_name: str, - parameters: _models.ApplicationResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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 ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. 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 ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ApplicationResource]: - """Creates or updates a Service Fabric managed application resource. - - Create or update a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource. Is either a ApplicationResource type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource or - IO[bytes] - :return: An instance of LROPoller that returns either ApplicationResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :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.ApplicationResource] = 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, - cluster_name=cluster_name, - application_name=application_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("ApplicationResource", 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.ApplicationResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ApplicationResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: _models.ApplicationUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. 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: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - parameters: Union[_models.ApplicationUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ApplicationResource: - """Updates the tags of an application resource of a given managed cluster. - - Updates the tags of an application resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param parameters: The application resource updated tags. Is either a - ApplicationUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters - or IO[bytes] - :return: ApplicationResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource - :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.ApplicationResource] = 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, "ApplicationUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ApplicationResource", 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, cluster_name: str, application_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, - cluster_name=cluster_name, - application_name=application_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Service Fabric managed application resource. - - Delete a Service Fabric managed application resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_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, - cluster_name=cluster_name, - application_name=application_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 list( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.ApplicationResource"]: - """Gets the list of managed application resources created in the specified Service Fabric cluster - resource. - - Gets all managed application resources created or in the process of being created in the - Service Fabric cluster resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either ApplicationResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] - :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.ApplicationResourceList] = 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, - cluster_name=cluster_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("ApplicationResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py deleted file mode 100644 index d74b0bfb62fa..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_apply_maintenance_window_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_post_request(resource_group_name: str, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applyMaintenanceWindow", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedApplyMaintenanceWindowOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_apply_maintenance_window` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def post( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> None: - """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any - pending update will be applied. - - Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any - pending update will be applied. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_post_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py deleted file mode 100644 index 66b4a0cd023c..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getazresiliencystatus", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedAzResiliencyStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_az_resiliency_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ManagedAzResiliencyStatus: - """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric - Managed Clusters. - - Action to get Az Resiliency Status of all the Base resources constituting Service Fabric - Managed Clusters. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedAzResiliencyStatus or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus - :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.ManagedAzResiliencyStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedAzResiliencyStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py deleted file mode 100644 index 37a1776c5fb3..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py +++ /dev/null @@ -1,429 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, List, Optional, TypeVar, Union - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "clusterVersion": _SERIALIZER.url("cluster_version", cluster_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_get_by_environment_request( - location: str, - environment: Union[str, _models.ManagedClusterVersionEnvironment], - cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "environment": _SERIALIZER.url("environment", environment, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "clusterVersion": _SERIALIZER.url("cluster_version", cluster_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, 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_environment_request( - location: str, - environment: Union[str, _models.ManagedClusterVersionEnvironment], - 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "environment": _SERIALIZER.url("environment", environment, "str"), - "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) - - -class ManagedClusterVersionOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_cluster_version` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, location: str, cluster_version: str, **kwargs: Any) -> _models.ManagedClusterCodeVersionResult: - """Gets information about a Service Fabric managed cluster code version available in the specified - location. - - Gets information about an available Service Fabric managed cluster code version. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param cluster_version: The cluster code version. Required. - :type cluster_version: str - :return: ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult - :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - cluster_version=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedClusterCodeVersionResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get_by_environment( - self, - location: str, - environment: Union[str, _models.ManagedClusterVersionEnvironment], - cluster_version: str, - **kwargs: Any - ) -> _models.ManagedClusterCodeVersionResult: - """Gets information about a Service Fabric cluster code version available for the specified - environment. - - Gets information about an available Service Fabric cluster code version by environment. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param environment: The operating system of the cluster. The default means all. "Windows" - Required. - :type environment: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment - :param cluster_version: The cluster code version. Required. - :type cluster_version: str - :return: ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult - :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) - - _request = build_get_by_environment_request( - location=location, - environment=environment, - cluster_version=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedClusterCodeVersionResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> List[_models.ManagedClusterCodeVersionResult]: - """Gets the list of Service Fabric cluster code versions available for the specified location. - - Gets all available code versions for Service Fabric cluster resources by location. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :return: list of ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] - :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) - - _request = build_list_request( - location=location, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ManagedClusterCodeVersionResult]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def list_by_environment( - self, location: str, environment: Union[str, _models.ManagedClusterVersionEnvironment], **kwargs: Any - ) -> List[_models.ManagedClusterCodeVersionResult]: - """Gets the list of Service Fabric cluster code versions available for the specified environment. - - Gets all available code versions for Service Fabric cluster resources by environment. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param environment: The operating system of the cluster. The default means all. "Windows" - Required. - :type environment: str or - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment - :return: list of ManagedClusterCodeVersionResult or the result of cls(response) - :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] - :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) - - _request = build_list_by_environment_request( - location=location, - environment=environment, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("[ManagedClusterCodeVersionResult]", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py deleted file mode 100644 index 41a02784b136..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py +++ /dev/null @@ -1,920 +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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters" - ) - 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_get_request(resource_group_name: str, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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_create_or_update_request( - resource_group_name: str, cluster_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, cluster_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedClustersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_clusters` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.ManagedCluster"]: - """Gets the list of Service Fabric cluster resources created in the specified resource group. - - Gets all Service Fabric cluster resources created or in the process of being created in the - resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :return: An iterator like instance of either ManagedCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :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.ManagedClusterListResult] = 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("ManagedClusterListResult", 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.ErrorModel, 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) -> Iterable["_models.ManagedCluster"]: - """Gets the list of Service Fabric cluster resources created in the specified subscription. - - Gets all Service Fabric cluster resources created or in the process of being created in the - subscription. - - :return: An iterator like instance of either ManagedCluster or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :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.ManagedClusterListResult] = 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("ManagedClusterListResult", 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.ErrorModel, 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, cluster_name: str, **kwargs: Any) -> _models.ManagedCluster: - """Gets a Service Fabric managed cluster resource. - - Get a Service Fabric managed cluster resource created or in the process of being created in the - specified resource group. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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.ManagedCluster] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedCluster", 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, - cluster_name: str, - parameters: Union[_models.ManagedCluster, 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, "ManagedCluster") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - parameters: _models.ManagedCluster, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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 ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. 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 ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - parameters: Union[_models.ManagedCluster, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ManagedCluster]: - """Creates or updates a Service Fabric managed cluster resource. - - Create or update a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The cluster resource. Is either a ManagedCluster type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster or IO[bytes] - :return: An instance of LROPoller that returns either ManagedCluster or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: 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.ManagedCluster] = 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, - cluster_name=cluster_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("ManagedCluster", 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.ManagedCluster].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ManagedCluster]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: _models.ManagedClusterUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. 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: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_name: str, - parameters: Union[_models.ManagedClusterUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ManagedCluster: - """Updates the tags of of a Service Fabric managed cluster resource. - - Update the tags of of a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param parameters: The managed cluster resource updated tags. Is either a - ManagedClusterUpdateParameters type or a IO[bytes] type. Required. - :type parameters: - ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters or IO[bytes] - :return: ManagedCluster or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster - :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.ManagedCluster] = 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, "ManagedClusterUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedCluster", 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, cluster_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, - cluster_name=cluster_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, **kwargs: Any) -> LROPoller[None]: - """Deletes a Service Fabric managed cluster resource. - - Delete a Service Fabric managed cluster resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_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, - cluster_name=cluster_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py deleted file mode 100644 index a01cfb532418..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_maintenance_window_status_operations.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getMaintenanceWindowStatus", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ManagedMaintenanceWindowStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_maintenance_window_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> _models.ManagedMaintenanceWindowStatus: - """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. - - Action to get Maintenance Window Status of the Service Fabric Managed Clusters. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: ManagedMaintenanceWindowStatus or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus - :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.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedMaintenanceWindowStatus", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py deleted file mode 100644 index ef8de87f3633..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py +++ /dev/null @@ -1,255 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "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_get_request(location: str, vm_size: 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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "location": _SERIALIZER.url("location", location, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "vmSize": _SERIALIZER.url("vm_size", vm_size, "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 ManagedUnsupportedVMSizesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`managed_unsupported_vm_sizes` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list(self, location: str, **kwargs: Any) -> Iterable["_models.ManagedVMSize"]: - """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - - Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :return: An iterator like instance of either ManagedVMSize or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] - :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.ManagedVMSizesResult] = 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, - 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("ManagedVMSizesResult", 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.ErrorModel, 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, location: str, vm_size: str, **kwargs: Any) -> _models.ManagedVMSize: - """Get unsupported vm size for Service Fabric Managed Clusters. - - Get unsupported vm size for Service Fabric Managed Clusters. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param vm_size: VM Size name. Required. - :type vm_size: str - :return: ManagedVMSize or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize - :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.ManagedVMSize] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - vm_size=vm_size, - 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ManagedVMSize", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py deleted file mode 100644 index 6ac1e167022e..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py +++ /dev/null @@ -1,180 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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 NodeTypeSkusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`node_type_skus` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list( - self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any - ) -> Iterable["_models.NodeTypeAvailableSku"]: - """Gets a Service Fabric node type SKUs. - - Get a Service Fabric node type supported SKUs. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :return: An iterator like instance of either NodeTypeAvailableSku or the result of - cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] - :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.NodeTypeListSkuResult] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeTypeListSkuResult", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py deleted file mode 100644 index 6a09a740057d..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py +++ /dev/null @@ -1,1670 +0,0 @@ -# pylint: disable=too-many-lines -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -from io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_managed_clusters_request( - resource_group_name: str, cluster_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes", - ) # pylint: disable=line-too-long - path_format_arguments = { - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_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_restart_request( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_reimage_request( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_delete_node_request( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_get_request( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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, cluster_name: str, node_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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, cluster_name: str, node_type_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_delete_request( - resource_group_name: str, cluster_name: str, node_type_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_name, "str"), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class NodeTypesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`node_types` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def list_by_managed_clusters( - self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> Iterable["_models.NodeType"]: - """Gets the list of Node types of the specified managed cluster. - - Gets all Node types of the specified managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :return: An iterator like instance of either NodeType or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeTypeListResult] = 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_managed_clusters_request( - resource_group_name=resource_group_name, - cluster_name=cluster_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("NodeTypeListResult", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - def _restart_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_restart_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_restart( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Restarts one or more nodes on the node type. - - Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a - restart on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for restart action. Is either a NodeTypeActionParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._restart_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _reimage_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_reimage_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_reimage( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Reimages one or more nodes on the node type. - - Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a - reimage on the VMs and activate the nodes back again. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for reimage action. Is either a NodeTypeActionParameters type or - a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._reimage_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _delete_node_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, 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, "NodeTypeActionParameters") - - _request = build_delete_node_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeActionParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters - :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_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Required. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either None or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_delete_node( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeActionParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[None]: - """Deletes one or more nodes on the node type. - - Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete - on the VMs and removes the state from the cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: parameters for delete action. Is either a NodeTypeActionParameters type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._delete_node_initial( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_name, - parameters=parameters, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any) -> _models.NodeType: - """Gets a Service Fabric node type. - - Get a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :return: NodeType or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType - :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.NodeType] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("NodeType", 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, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeType, 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, "NodeType") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeType, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType - :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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. 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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeType, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Creates or updates a Service Fabric node type. - - Create or update a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The node type resource. Is either a NodeType type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType or IO[bytes] - :return: An instance of LROPoller that returns either NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeType] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeType", 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.NodeType].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NodeType]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeUpdateParameters, 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, "NodeTypeUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - node_type_name: str, - parameters: _models.NodeTypeUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters - :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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. 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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - cluster_name: str, - node_type_name: str, - parameters: Union[_models.NodeTypeUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.NodeType]: - """Update the tags of a node type resource of a given managed cluster. - - Update the configuration of a node type of a given managed cluster, only updating tags. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_name: str - :param parameters: The parameters to update the node type configuration. Is either a - NodeTypeUpdateParameters type or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters or - IO[bytes] - :return: An instance of LROPoller that returns either NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] - :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.NodeType] = 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, - cluster_name=cluster_name, - node_type_name=node_type_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("NodeType", 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.NodeType].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.NodeType]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, cluster_name: str, node_type_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, - cluster_name=cluster_name, - node_type_name=node_type_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, node_type_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Service Fabric node type. - - Delete a Service Fabric node type of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param node_type_name: The name of the node type. Required. - :type node_type_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, - cluster_name=cluster_name, - node_type_name=node_type_name, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py deleted file mode 100644 index 55172e7ec8a8..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py +++ /dev/null @@ -1,145 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, operation_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_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) - - -class OperationResultsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`operation_results` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( # pylint: disable=inconsistent-return-statements - self, location: str, operation_id: str, **kwargs: Any - ) -> None: - """Get long running operation result. - - Get long running operation result. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param operation_id: operation identifier. Required. - :type operation_id: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_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, 202, 204]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, 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")) - - if cls: - return cls(pipeline_response, None, response_headers) # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py deleted file mode 100644 index fbb7d769113d..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Optional, TypeVar - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, operation_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "location": _SERIALIZER.url("location", location, "str"), - "operationId": _SERIALIZER.url("operation_id", operation_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) - - -class OperationStatusOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`operation_status` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get(self, location: str, operation_id: str, **kwargs: Any) -> _models.LongRunningOperationResult: - """Get long running operation status. - - Get long running operation status. - - :param location: The location for the cluster code versions. This is different from cluster - location. Required. - :type location: str - :param operation_id: operation identifier. Required. - :type operation_id: str - :return: LongRunningOperationResult or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult - :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.LongRunningOperationResult] = kwargs.pop("cls", None) - - _request = build_get_request( - location=location, - operation_id=operation_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("LongRunningOperationResult", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py index a75bd9a30194..3d0a9aef4213 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py @@ -1,52 +1,1903 @@ +# 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. # -------------------------------------------------------------------------- -import sys -from typing import Any, Callable, Dict, Iterable, Optional, TypeVar +from collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, 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 .._serialization import Serializer +from .._configuration import ServiceFabricManagedClustersManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from .._utils.serialization import Deserializer, Serializer -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +JSON = MutableMapping[str, Any] _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", "2024-09-01-preview")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceFabric/operations") + _url = "/providers/Microsoft.ServiceFabric/operations" + + # Construct parameters + _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_applications_get_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_update_request( + resource_group_name: str, cluster_name: str, application_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_delete_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_list_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_applications_read_upgrade_request( + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/fetchUpgradeStatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_resume_upgrade_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/resumeUpgrade" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_applications_start_rollback_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/startRollback" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_application_types_get_request( + resource_group_name: str, cluster_name: str, application_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_application_types_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_application_types_update_request( + resource_group_name: str, cluster_name: str, application_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_application_types_delete_request( + resource_group_name: str, cluster_name: str, application_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_application_types_list_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_application_type_versions_get_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + application_type_name: 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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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_application_type_versions_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + application_type_name: 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 {}) + + 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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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 + 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_application_type_versions_update_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + application_type_name: 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 {}) + + 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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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 + 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_application_type_versions_delete_request( # pylint: disable=name-too-long + resource_group_name: str, + cluster_name: str, + application_type_name: 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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, "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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_application_type_versions_list_by_application_types_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applicationTypes/{applicationTypeName}/versions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_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_services_get_request( + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/services/{serviceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_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_services_create_or_update_request( + resource_group_name: str, + cluster_name: str, + application_name: str, + service_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/services/{serviceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_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_services_update_request( + resource_group_name: str, + cluster_name: str, + application_name: str, + service_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/services/{serviceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_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_services_delete_request( + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/services/{serviceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_name, "str"), + "serviceName": _SERIALIZER.url("service_name", service_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_services_list_by_applications_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, application_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applications/{applicationName}/services" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "applicationName": _SERIALIZER.url("application_name", application_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_managed_cluster_version_get_request( # pylint: disable=name-too-long + location: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_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_managed_cluster_version_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_managed_cluster_version_get_by_environment_request( # pylint: disable=name-too-long + location: str, + environment: Union[str, _models.ManagedClusterVersionEnvironment], + cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "environment": _SERIALIZER.url("environment", environment, "str"), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_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_managed_cluster_version_list_by_environment_request( # pylint: disable=name-too-long + location: str, + environment: Union[str, _models.ManagedClusterVersionEnvironment], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "environment": _SERIALIZER.url("environment", environment, "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_managed_unsupported_vm_sizes_get_request( # pylint: disable=name-too-long + location: str, vm_size: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "vmSize": _SERIALIZER.url("vm_size", vm_size, "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_managed_unsupported_vm_sizes_list_request( # pylint: disable=name-too-long + location: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "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_managed_clusters_get_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_update_request( + resource_group_name: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_delete_request( + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters" + 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_managed_clusters_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters" + 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_managed_clusters_get_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_list_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/listFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_start_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/startFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_clusters_stop_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/stopFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_az_resiliency_status_get_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getazresiliencystatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_apply_maintenance_window_post_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/applyMaintenanceWindow" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_managed_maintenance_window_status_get_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/getMaintenanceWindowStatus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_node_types_get_request( + resource_group_name: str, cluster_name: str, node_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_update_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_delete_request( + resource_group_name: str, cluster_name: str, node_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_list_by_managed_clusters_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_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_node_types_deallocate_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deallocate" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_delete_node_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_redeploy_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/redeploy" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_reimage_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_restart_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_start_request( + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/start" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_start_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/startFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_stop_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/stopFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_get_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, node_type_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-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/getFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_types_list_fault_simulation_request( # pylint: disable=name-too-long + resource_group_name: str, cluster_name: str, node_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/listFaultSimulation" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_node_type_skus_list_request( + resource_group_name: str, cluster_name: str, node_type_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_type_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_operation_results_get_request( + location: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_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_operation_status_get_request( + location: str, operation_id: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-03-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "location": _SERIALIZER.url("location", location, "str"), + "operationId": _SERIALIZER.url("operation_id", operation_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -64,34 +1915,8934 @@ class Operations: Instead, you should access the following operations through :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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) -> Iterable["_models.OperationResult"]: + """Lists all of the available Service Fabric resource provider API operations. + + Get the list of available Service Fabric resource provider API operations. + + :return: An iterator like instance of OperationResult + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.OperationResult] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.OperationResult]] = kwargs.pop("cls", None) + + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + def prepare_request(next_link=None): + if not next_link: + + _request = build_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.OperationResult], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`applications` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_name: str, **kwargs: Any + ) -> _models.ApplicationResource: + """Get a Service Fabric managed application resource created or in the process of being created in + the Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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.ApplicationResource] = kwargs.pop("cls", None) + + _request = build_applications_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationResource, 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, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationResource, 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_applications_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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 ApplicationResource. The ApplicationResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. 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 ApplicationResource. The ApplicationResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. 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 ApplicationResource. The ApplicationResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: + """Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource. Is one of the following types: + ApplicationResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource or JSON + or IO[bytes] + :return: An instance of LROPoller that returns ApplicationResource. The ApplicationResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :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.ApplicationResource] = 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, + cluster_name=cluster_name, + application_name=application_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.ApplicationResource, 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.ApplicationResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApplicationResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. 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: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. 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: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.ApplicationUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationResource: + """Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The application resource updated tags. Is one of the following types: + ApplicationUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationUpdateParameters + or JSON or IO[bytes] + :return: ApplicationResource. The ApplicationResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource + :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.ApplicationResource] = 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_applications_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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, + cluster_name=cluster_name, + application_name=application_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, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationResource"]: + """Gets all managed application resources created or in the process of being created in the + Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of ApplicationResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApplicationResource]] = 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_applications_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApplicationResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _read_upgrade_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_read_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_read_upgrade( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Get the status of the latest application upgrade. It will query the cluster to find the status + of the latest application upgrade. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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._read_upgrade_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_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 + + def _resume_upgrade_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, 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_applications_resume_upgrade_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.RuntimeResumeApplicationUpgradeParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters + :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_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_resume_upgrade( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: Union[_models.RuntimeResumeApplicationUpgradeParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Send a request to resume the current application upgrade. This will resume the application + upgrade from where it was paused. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param parameters: The parameters for resuming an application upgrade. Is one of the following + types: RuntimeResumeApplicationUpgradeParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.RuntimeResumeApplicationUpgradeParameters 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._resume_upgrade_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_rollback_initial( + self, resource_group_name: str, cluster_name: str, application_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_applications_start_rollback_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202]: + 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_start_rollback( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Send a request to start a rollback of the current application upgrade. This will start rolling + back the application to the previous version. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_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._start_rollback_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class ApplicationTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_types` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Get a Service Fabric application type name resource created or in the process of being created + in the Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = kwargs.pop("cls", None) + + _request = build_application_types_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, 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, + cluster_name: str, + application_type_name: str, + parameters: _models.ApplicationTypeResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: Union[_models.ApplicationTypeResource, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type name resource. Is one of the following types: + ApplicationTypeResource, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource or + JSON or IO[bytes] + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = 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_application_types_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: _models.ApplicationTypeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. 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: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: Union[_models.ApplicationTypeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeResource: + """Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param parameters: The application type resource updated tags. Is one of the following types: + ApplicationTypeUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeUpdateParameters or JSON or + IO[bytes] + :return: ApplicationTypeResource. The ApplicationTypeResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource + :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.ApplicationTypeResource] = 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_application_types_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_type_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_application_types_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Service Fabric managed application type name resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_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, + cluster_name=cluster_name, + application_type_name=application_type_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, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationTypeResource"]: + """Gets all application type name resources created or in the process of being created in the + Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of ApplicationTypeResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApplicationTypeResource]] = 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_application_types_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApplicationTypeResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ApplicationTypeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`application_type_versions` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_type_name: str, version: str, **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Get a Service Fabric managed application type version resource created or in the process of + being created in the Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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.ApplicationTypeVersionResource] = kwargs.pop("cls", None) + + _request = build_application_type_versions_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeVersionResource, 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, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionResource, 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_application_type_versions_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. 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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. 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 ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ApplicationTypeVersionResource]: + """Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource. Is one of the following types: + ApplicationTypeVersionResource, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ApplicationTypeVersionResource. The + ApplicationTypeVersionResource is compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :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.ApplicationTypeVersionResource] = 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, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + 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.ApplicationTypeVersionResource, 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.ApplicationTypeVersionResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ApplicationTypeVersionResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. 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: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: Union[_models.ApplicationTypeVersionUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: + """Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: str + :param parameters: The application type version resource updated tags. Is one of the following + types: ApplicationTypeVersionUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionUpdateParameters or JSON + or IO[bytes] + :return: ApplicationTypeVersionResource. The ApplicationTypeVersionResource is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource + :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.ApplicationTypeVersionResource] = 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_application_type_versions_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ApplicationTypeVersionResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_type_name: str, version: 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_application_type_versions_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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) + + _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.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Service Fabric managed application type version resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :param version: The application type version. Required. + :type version: 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, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=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 + + 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_application_types( + self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any + ) -> Iterable["_models.ApplicationTypeVersionResource"]: + """Gets all application type version resources created or in the process of being created in the + Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. Required. + :type application_type_name: str + :return: An iterator like instance of ApplicationTypeVersionResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ApplicationTypeVersionResource]] = 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_application_type_versions_list_by_application_types_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ApplicationTypeVersionResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`services` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, application_name: str, service_name: str, **kwargs: Any + ) -> _models.ServiceResource: + """Get a Service Fabric service resource created or in the process of being created in the Service + Fabric managed application resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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.ServiceResource] = kwargs.pop("cls", None) + + _request = build_services_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceResource, 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, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceResource, 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_services_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResource, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. 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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. 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 ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceResource, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: + """Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource. Is one of the following types: ServiceResource, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ServiceResource. The ServiceResource is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :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.ServiceResource] = 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, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_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.ServiceResource, 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.ServiceResource].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ServiceResource]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. 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: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. 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: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: Union[_models.ServiceUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ServiceResource: + """Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_name: str + :param parameters: The service resource updated tags. Is one of the following types: + ServiceUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters or + JSON or IO[bytes] + :return: ServiceResource. The ServiceResource is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource + :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.ServiceResource] = 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_services_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ServiceResource, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, application_name: str, service_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_services_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. Required. + :type service_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, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_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_applications( + self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any + ) -> Iterable["_models.ServiceResource"]: + """Gets all service resources created or in the process of being created in the Service Fabric + managed application resource. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param application_name: The name of the application resource. Required. + :type application_name: str + :return: An iterator like instance of ServiceResource + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ServiceResource]] = 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_services_list_by_applications_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ServiceResource], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ManagedClusterVersionOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_cluster_version` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_version: str, **kwargs: Any) -> _models.ManagedClusterCodeVersionResult: + """Gets information about a Service Fabric managed cluster code version available in the specified + location. + + Gets information about an available Service Fabric managed cluster code version. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param cluster_version: The cluster code version. Required. + :type cluster_version: str + :return: ManagedClusterCodeVersionResult. The ManagedClusterCodeVersionResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult + :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_get_request( + location=location, + cluster_version=cluster_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedClusterCodeVersionResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> List[_models.ManagedClusterCodeVersionResult]: + """Gets the list of Service Fabric cluster code versions available for the specified location. + + Gets all available code versions for Service Fabric cluster resources by location. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :return: list of ManagedClusterCodeVersionResult + :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] + :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.ManagedClusterCodeVersionResult], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def get_by_environment( + self, + location: str, + environment: Union[str, _models.ManagedClusterVersionEnvironment], + cluster_version: str, + **kwargs: Any + ) -> _models.ManagedClusterCodeVersionResult: + """Gets information about a Service Fabric cluster code version available for the specified + environment. + + Gets information about an available Service Fabric cluster code version by environment. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param environment: The operating system of the cluster. "Windows" Required. + :type environment: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment + :param cluster_version: The cluster code version. Required. + :type cluster_version: str + :return: ManagedClusterCodeVersionResult. The ManagedClusterCodeVersionResult is compatible + with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult + :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.ManagedClusterCodeVersionResult] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_get_by_environment_request( + location=location, + environment=environment, + cluster_version=cluster_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedClusterCodeVersionResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_by_environment( + self, location: str, environment: Union[str, _models.ManagedClusterVersionEnvironment], **kwargs: Any + ) -> List[_models.ManagedClusterCodeVersionResult]: + """Gets the list of Service Fabric cluster code versions available for the specified environment. + + Gets all available code versions for Service Fabric cluster resources by environment. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param environment: The operating system of the cluster. "Windows" Required. + :type environment: str or + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterVersionEnvironment + :return: list of ManagedClusterCodeVersionResult + :rtype: list[~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterCodeVersionResult] + :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[List[_models.ManagedClusterCodeVersionResult]] = kwargs.pop("cls", None) + + _request = build_managed_cluster_version_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(List[_models.ManagedClusterCodeVersionResult], response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ManagedUnsupportedVMSizesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_unsupported_vm_sizes` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, vm_size: str, **kwargs: Any) -> _models.ManagedVMSize: + """Get unsupported vm size for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :param vm_size: VM Size name. Required. + :type vm_size: str + :return: ManagedVMSize. The ManagedVMSize is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize + :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.ManagedVMSize] = kwargs.pop("cls", None) + + _request = build_managed_unsupported_vm_sizes_get_request( + location=location, + vm_size=vm_size, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedVMSize, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list(self, location: str, **kwargs: Any) -> Iterable["_models.ManagedVMSize"]: + """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. Required. + :type location: str + :return: An iterator like instance of ManagedVMSize + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedVMSize] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedVMSize]] = 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_managed_unsupported_vm_sizes_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedVMSize], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class ManagedClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_clusters` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any) -> _models.ManagedCluster: + """Get a Service Fabric managed cluster resource created or in the process of being created in the + specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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.ManagedCluster] = kwargs.pop("cls", None) + + _request = build_managed_clusters_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedCluster, 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, + cluster_name: str, + parameters: Union[_models.ManagedCluster, 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_managed_clusters_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.ManagedCluster, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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 ManagedCluster. The ManagedCluster is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. 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 ManagedCluster. The ManagedCluster is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. 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 ManagedCluster. The ManagedCluster is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.ManagedCluster, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.ManagedCluster]: + """Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The cluster resource. Is one of the following types: ManagedCluster, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster or JSON or + IO[bytes] + :return: An instance of LROPoller that returns ManagedCluster. The ManagedCluster is compatible + with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :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.ManagedCluster] = 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, + cluster_name=cluster_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.ManagedCluster, 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.ManagedCluster].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.ManagedCluster]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.ManagedClusterUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. 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: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. 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: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.ManagedClusterUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.ManagedCluster: + """Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. Is one of the following types: + ManagedClusterUpdateParameters, JSON, IO[bytes] Required. + :type parameters: + ~azure.mgmt.servicefabricmanagedclusters.models.ManagedClusterUpdateParameters or JSON or + IO[bytes] + :return: ManagedCluster. The ManagedCluster is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster + :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.ManagedCluster] = 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_managed_clusters_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedCluster, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial(self, resource_group_name: str, cluster_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_managed_clusters_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, cluster_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_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, + cluster_name=cluster_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) -> Iterable["_models.ManagedCluster"]: + """Gets all Service Fabric cluster resources created or in the process of being created in the + 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 ManagedCluster + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedCluster]] = 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_managed_clusters_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.ManagedCluster], 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.json()) + 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) -> Iterable["_models.ManagedCluster"]: + """Gets all Service Fabric cluster resources created or in the process of being created in the + subscription. + + :return: An iterator like instance of ManagedCluster + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.ManagedCluster]] = 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_managed_clusters_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), 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.ManagedCluster], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :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.FaultSimulation] = 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_managed_clusters_get_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FaultSimulation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_fault_simulation( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.FaultSimulation"]: + """Gets the list of recent fault simulations for the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of FaultSimulation + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FaultSimulation]] = 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_managed_clusters_list_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FaultSimulation], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _start_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, 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_managed_clusters_start_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationContentWrapper, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameters describing the fault simulation. Is one of the following types: + FaultSimulationContentWrapper, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + or JSON or IO[bytes] + :return: An instance of LROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._start_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, 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_managed_clusters_stop_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: An instance of LROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._stop_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + +class ManagedAzResiliencyStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_az_resiliency_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any) -> _models.ManagedAzResiliencyStatus: + """Action to get Az Resiliency Status of all the Base resources constituting Service Fabric + Managed Clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedAzResiliencyStatus. The ManagedAzResiliencyStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedAzResiliencyStatus + :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.ManagedAzResiliencyStatus] = kwargs.pop("cls", None) + + _request = build_managed_az_resiliency_status_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedAzResiliencyStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class ManagedApplyMaintenanceWindowOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_apply_maintenance_window` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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 post( # pylint: disable=inconsistent-return-statements + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> None: + """Action to Apply Maintenance window on the Service Fabric Managed Clusters, right now. Any + pending update will be applied. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: None + :rtype: None + :raises ~azure.core.exceptions.HttpResponseError: + """ + error_map: MutableMapping = { + 401: ClientAuthenticationError, + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[None] = kwargs.pop("cls", None) + + _request = build_managed_apply_maintenance_window_post_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + +class ManagedMaintenanceWindowStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`managed_maintenance_window_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, **kwargs: Any) -> _models.ManagedMaintenanceWindowStatus: + """Action to get Maintenance Window Status of the Service Fabric Managed Clusters. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: ManagedMaintenanceWindowStatus. The ManagedMaintenanceWindowStatus is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ManagedMaintenanceWindowStatus + :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.ManagedMaintenanceWindowStatus] = kwargs.pop("cls", None) + + _request = build_managed_maintenance_window_status_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.ManagedMaintenanceWindowStatus, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + +class NodeTypesOperations: # pylint: disable=too-many-public-methods + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_types` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, cluster_name: str, node_type_name: str, **kwargs: Any) -> _models.NodeType: + """Get a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: NodeType. The NodeType is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType + :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.NodeType] = kwargs.pop("cls", None) + + _request = build_node_types_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.NodeType, 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, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeType, 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_node_types_create_or_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeType, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType + :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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeType, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The node type resource. Is one of the following types: NodeType, JSON, + IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeType or JSON or IO[bytes] + :return: An instance of LROPoller that returns NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :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.NodeType] = 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, + cluster_name=cluster_name, + node_type_name=node_type_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.NodeType, 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.NodeType].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NodeType]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _update_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeUpdateParameters, 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_node_types_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeUpdateParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters + :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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. 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 NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeUpdateParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.NodeType]: + """Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. Is one of the + following types: NodeTypeUpdateParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeUpdateParameters or + JSON or IO[bytes] + :return: An instance of LROPoller that returns NodeType. The NodeType is compatible with + MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :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.NodeType] = 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, + cluster_name=cluster_name, + node_type_name=node_type_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.NodeType, 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.NodeType].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.NodeType]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial( + self, resource_group_name: str, cluster_name: str, node_type_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_node_types_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [202, 204]: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_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, + cluster_name=cluster_name, + node_type_name=node_type_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_managed_clusters( + self, resource_group_name: str, cluster_name: str, **kwargs: Any + ) -> Iterable["_models.NodeType"]: + """Gets all Node types of the specified managed cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :return: An iterator like instance of NodeType + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.NodeType]] = 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_node_types_list_by_managed_clusters_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.NodeType], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + def _deallocate_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_deallocate_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_deallocate( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Deallocates one or more nodes on the node type. It will disable the fabric nodes, trigger a + shutdown on the VMs and release them from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for deallocate action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._deallocate_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _delete_node_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_delete_node_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for delete action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._delete_node_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _redeploy_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_redeploy_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_redeploy( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Redeploys one or more nodes on the node type. It will disable the fabric nodes, trigger a shut + down on the VMs, move them to a new node, and power them back on. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for redeploy action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._redeploy_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _reimage_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_reimage_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for reimage action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._reimage_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _restart_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_restart_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for restart action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._restart_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, 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_node_types_start_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + 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 cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.NodeTypeActionParameters, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters + :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_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Required. + :type parameters: IO[bytes] + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. + Default value is "application/json". + :paramtype content_type: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.NodeTypeActionParameters, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[None]: + """Starts one or more nodes on the node type. It will trigger an allocation of the fabric node if + needed and activate them. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters for start action. Is one of the following types: + NodeTypeActionParameters, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeActionParameters 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._start_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + content_type=content_type, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + def _start_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, 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_node_types_start_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationContentWrapper, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_start_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationContentWrapper, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Starts a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameters describing the fault simulation. Is one of the following types: + FaultSimulationContentWrapper, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationContentWrapper + or JSON or IO[bytes] + :return: An instance of LROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._start_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _stop_fault_simulation_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, 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_node_types_stop_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = True + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) + response_headers["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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 FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_stop_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.FaultSimulation]: + """Stops a fault simulation on the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: An instance of LROPoller that returns FaultSimulation. The FaultSimulation is + compatible with MutableMapping + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :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.FaultSimulation] = 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._stop_fault_simulation_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_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["Azure-AsyncOperation"] = self._deserialize( + "str", response.headers.get("Azure-AsyncOperation") + ) + + deserialized = _deserialize(_models.FaultSimulation, 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.FaultSimulation].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.FaultSimulation]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: _models.FaultSimulationIdContent, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. 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: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def get_fault_simulation( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: Union[_models.FaultSimulationIdContent, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.FaultSimulation: + """Gets a fault simulation by the simulationId. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :param parameters: parameter with fault simulation id. Is one of the following types: + FaultSimulationIdContent, JSON, IO[bytes] Required. + :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulationIdContent or + JSON or IO[bytes] + :return: FaultSimulation. The FaultSimulation is compatible with MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation + :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.FaultSimulation] = 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_node_types_get_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("stream", False) + pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + + response = pipeline_response.http_response + + if response.status_code not in [200]: + if _stream: + try: + response.read() # Load the body in memory and close the socket + except (StreamConsumedError, StreamClosedError): + pass + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.FaultSimulation, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def list_fault_simulation( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> Iterable["_models.FaultSimulation"]: + """Gets the list of recent fault simulations for the node type. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: An iterator like instance of FaultSimulation + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.FaultSimulation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.FaultSimulation]] = 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_node_types_list_fault_simulation_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.FaultSimulation], 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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class NodeTypeSkusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`node_type_skus` attribute. """ - models = _models - - def __init__(self, *args, **kwargs): + def __init__(self, *args, **kwargs) -> None: input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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) -> Iterable["_models.OperationResult"]: - """Lists all of the available Service Fabric resource provider API operations. - - Get the list of available Service Fabric resource provider API operations. + def list( + self, resource_group_name: str, cluster_name: str, node_type_name: str, **kwargs: Any + ) -> Iterable["_models.NodeTypeAvailableSku"]: + """Get a Service Fabric node type supported SKUs. - :return: An iterator like instance of either OperationResult or the result of cls(response) + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. Required. + :type cluster_name: str + :param node_type_name: The name of the node type. Required. + :type node_type_name: str + :return: An iterator like instance of NodeTypeAvailableSku :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.OperationResult] + ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.NodeTypeAvailableSku] :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.NodeTypeAvailableSku]] = kwargs.pop("cls", None) error_map: MutableMapping = { 401: ClientAuthenticationError, @@ -104,12 +10855,21 @@ def list(self, **kwargs: Any) -> Iterable["_models.OperationResult"]: def prepare_request(next_link=None): if not next_link: - _request = build_list_request( - api_version=api_version, + _request = build_node_type_skus_list_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_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 @@ -124,16 +10884,21 @@ def prepare_request(next_link=None): _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" + path_format_arguments = { + "endpoint": self._serialize.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.NodeTypeAvailableSku], deserialized.get("value", [])) if cls: list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) + return deserialized.get("nextLink") or None, iter(list_of_elem) def get_next(next_link=None): _request = prepare_request(next_link) @@ -146,9 +10911,229 @@ 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.ErrorModel, pipeline_response) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return ItemPaged(get_next, extract_data) + + +class OperationResultsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_results` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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 _get_initial(self, location: str, operation_id: 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_operation_results_get_request( + location=location, + operation_id=operation_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) + + _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.json()) + 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.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_get(self, location: str, operation_id: str, **kwargs: Any) -> LROPoller[None]: + """Get long running operation result. + + Get long running operation result. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: operation identifier. Required. + :type operation_id: 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._get_initial( + location=location, + operation_id=operation_id, + cls=lambda x, y, z: x, + headers=_headers, + params=_params, + **kwargs + ) + raw_result.http_response.read() # type: ignore + kwargs.pop("error_map", None) + + def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements + if cls: + return cls(pipeline_response, None, {}) # type: ignore + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[None].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore + + +class OperationStatusOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s + :attr:`operation_status` 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: ServiceFabricManagedClustersManagementClientConfiguration = ( + 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, operation_id: str, **kwargs: Any) -> _models.LongRunningOperationResult: + """Get long running operation status. + + Get long running operation status. + + :param location: The name of the Azure region. Required. + :type location: str + :param operation_id: operation identifier. Required. + :type operation_id: str + :return: LongRunningOperationResult. The LongRunningOperationResult is compatible with + MutableMapping + :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.LongRunningOperationResult + :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.LongRunningOperationResult] = kwargs.pop("cls", None) + + _request = build_operation_status_get_request( + location=location, + operation_id=operation_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) + + _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.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.LongRunningOperationResult, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# 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 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py deleted file mode 100644 index 212b5c0a7763..000000000000 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py +++ /dev/null @@ -1,929 +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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, TypeVar, Union, cast, overload -import urllib.parse - -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 .._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore -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, - cluster_name: str, - application_name: str, - service_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_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, - cluster_name: str, - application_name: str, - service_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_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, - cluster_name: str, - application_name: str, - service_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", "2024-09-01-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_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_delete_request( - resource_group_name: str, - cluster_name: str, - application_name: str, - service_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_name, "str"), - "serviceName": _SERIALIZER.url("service_name", service_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_applications_request( - resource_group_name: str, cluster_name: str, application_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", "2024-09-01-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), - "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), - "clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str"), - "applicationName": _SERIALIZER.url("application_name", application_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 ServicesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.servicefabricmanagedclusters.ServiceFabricManagedClustersManagementClient`'s - :attr:`services` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - - @distributed_trace - def get( - self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, **kwargs: Any - ) -> _models.ServiceResource: - """Gets a Service Fabric managed service resource. - - Get a Service Fabric service resource created or in the process of being created in the Service - Fabric managed application resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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.ServiceResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceResource", 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, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceResource, 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, "ServiceResource") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_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")) - - 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, - cluster_name: str, - application_name: str, - service_name: str, - parameters: _models.ServiceResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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 ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. 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 ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceResource, IO[bytes]], - **kwargs: Any - ) -> LROPoller[_models.ServiceResource]: - """Creates or updates a Service Fabric managed service resource. - - Create or update a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource. Is either a ServiceResource type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource or IO[bytes] - :return: An instance of LROPoller that returns either ServiceResource or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :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.ServiceResource] = 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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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("ServiceResource", 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.ServiceResource].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.ServiceResource]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: _models.ServiceUpdateParameters, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. 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: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - cluster_name: str, - application_name: str, - service_name: str, - parameters: Union[_models.ServiceUpdateParameters, IO[bytes]], - **kwargs: Any - ) -> _models.ServiceResource: - """Updates the tags of a service resource of a given managed cluster. - - Updates the tags of a service resource of a given managed cluster. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_name: str - :param parameters: The service resource updated tags. Is either a ServiceUpdateParameters type - or a IO[bytes] type. Required. - :type parameters: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceUpdateParameters or - IO[bytes] - :return: ServiceResource or the result of cls(response) - :rtype: ~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource - :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.ServiceResource] = 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, "ServiceUpdateParameters") - - _request = build_update_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ServiceResource", 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, cluster_name: str, application_name: str, service_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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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.ErrorModel, pipeline_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")) - - 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, cluster_name: str, application_name: str, service_name: str, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Service Fabric managed service resource. - - Delete a Service Fabric managed service resource with the specified name. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :param service_name: The name of the service resource in the format of - {applicationName}~{serviceName}. Required. - :type service_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, - cluster_name=cluster_name, - application_name=application_name, - service_name=service_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 list_by_applications( - self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> Iterable["_models.ServiceResource"]: - """Gets the list of service resources created in the specified Service Fabric managed application - resource. - - Gets all service resources created or in the process of being created in the Service Fabric - managed application resource. - - :param resource_group_name: The name of the resource group. Required. - :type resource_group_name: str - :param cluster_name: The name of the cluster resource. Required. - :type cluster_name: str - :param application_name: The name of the application resource. Required. - :type application_name: str - :return: An iterator like instance of either ServiceResource or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabricmanagedclusters.models.ServiceResource] - :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.ServiceResourceList] = 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_applications_request( - resource_group_name=resource_group_name, - cluster_name=cluster_name, - application_name=application_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("ServiceResourceList", 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.ErrorModel, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py index bb1ad67fd4e5..e8540386ea74 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_get_upgrade_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.applications.begin_read_upgrade( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationActionGetUpgrade_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationActionGetUpgrade_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py index 079b612a9408..84ba937063ec 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_resume_upgrade_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.applications.begin_resume_upgrade( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationActionResumeUpgrade_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationActionResumeUpgrade_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py index fe74d9b5fd54..7d53ff68d19e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_action_start_rollback_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.applications.begin_start_rollback( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationActionStartRollback_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationActionStartRollback_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py index a47133f16424..db206386d754 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.applications.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py index 9692c0432a54..240782caaf9f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.applications.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py index d0120b303570..f60dcc674b32 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.applications.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py index 4363603cd723..373829802d29 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.applications.update( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationPatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py index 307b96fda2a2..8eeef355db69 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_max.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.applications.begin_create_or_update( @@ -77,6 +78,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationPutOperation_example_max.json +# x-ms-original-file: 2025-03-01-preview/ApplicationPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py index 7f267a7695b6..24e225eb3aba 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_put_operation_example_min.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.applications.begin_create_or_update( @@ -44,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationPutOperation_example_min.json +# x-ms-original-file: 2025-03-01-preview/ApplicationPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py index f005827d522b..58a16bbeee1a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.application_types.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeNameDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeNameDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py index 1a2ebbf30400..739b4d06f734 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_types.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeNameGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeNameGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py index e2de51c47e01..e053a8927a52 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_types.list( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeNameListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeNameListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py index 905415219129..ad3f0783fca0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_types.update( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeNamePatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeNamePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py index dd8bf7fa19f3..945060067ff2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_name_put_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_types.create_or_update( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeNamePutOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeNamePutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py index 84882231efa2..dfc0771878e7 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.application_type_versions.begin_delete( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeVersionDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeVersionDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py index 0fda6fe8c6e7..997821c51302 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_type_versions.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeVersionGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeVersionGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py index 69723bfc8718..2baeebbbb4cb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_type_versions.list_by_application_types( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeVersionListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeVersionListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py index f2a7f4697a2d..f1bd7e4bdb58 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_type_versions.update( @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeVersionPatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeVersionPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py index 387cfb9679a1..9abfe30785a2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/application_type_version_put_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.application_type_versions.begin_create_or_update( @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ApplicationTypeVersionPutOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ApplicationTypeVersionPutOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/deallocate_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/deallocate_nodes_example.py new file mode 100644 index 000000000000..7d422b3b1006 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/deallocate_nodes_example.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.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python deallocate_nodes_example.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 = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.node_types.begin_deallocate( + resource_group_name="resRg", + cluster_name="myCluster", + node_type_name="BE", + parameters={"nodes": ["BE_0", "BE_1"]}, + ).result() + + +# x-ms-original-file: 2025-03-01-preview/DeallocateNodes_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py index 4687d47726b3..5dc32f292369 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/delete_nodes_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.node_types.begin_delete_node( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/DeleteNodes_example.json +# x-ms-original-file: 2025-03-01-preview/DeleteNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py index 1d71f0204123..e1d02b25b0a2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_apply_maintenance_window_post_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.managed_apply_maintenance_window.post( @@ -36,6 +36,6 @@ def main(): ) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedApplyMaintenanceWindowPost_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedApplyMaintenanceWindowPost_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py index 4e315e5157a1..7784848e9b82 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_az_resiliency_status_get_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_az_resiliency_status.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/managedAzResiliencyStatusGet_example.json +# x-ms-original-file: 2025-03-01-preview/managedAzResiliencyStatusGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py index cdbceee50fd2..e6aa4b82dfa3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.managed_clusters.begin_delete( @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py index 93b50cfcf6b6..7d2a1e6fec97 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py index 389ffe910a83..6748fcd47730 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_resource_group_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.list_by_resource_group( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterListByResourceGroupOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterListByResourceGroupOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py index a9f115149733..39e702f67a84 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_list_by_subscription_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.list_by_subscription() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterListBySubscriptionOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterListBySubscriptionOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py index f6c086ed1a71..80d62b88601c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.update( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterPatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterPatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py index 54b745194068..4cc53c4bf0d8 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_max.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.begin_create_or_update( @@ -145,6 +146,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterPutOperation_example_max.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterPutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py index f856e5d50982..63c06a33bef3 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_put_operation_example_min.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_clusters.begin_create_or_update( @@ -51,6 +51,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterPutOperation_example_min.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterPutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py index 0f9257c38a57..ca3357f4ea08 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_by_environment_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_cluster_version.get_by_environment( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterVersionGetByEnvironment_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterVersionGetByEnvironment_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py index 2582d25ac4d7..7b16a1254836 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_get_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_cluster_version.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterVersionGet_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterVersionGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py index a12f78fbdea5..f8be50a8b77c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_by_environment.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_cluster_version.list_by_environment( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterVersionListByEnvironment.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterVersionListByEnvironment.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py index 1ec995a9afd5..d68f428e4f31 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_cluster_version_list_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_cluster_version.list( @@ -36,6 +36,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedClusterVersionList_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedClusterVersionList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py index 2b8c33775263..6ef654d91a82 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_maintenance_window_status_get_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_maintenance_window_status.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ManagedMaintenanceWindowStatusGet_example.json +# x-ms-original-file: 2025-03-01-preview/ManagedMaintenanceWindowStatusGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py index 19a633d1ae91..f98badbbd395 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_get_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_unsupported_vm_sizes.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/managedUnsupportedVMSizesGet_example.json +# x-ms-original-file: 2025-03-01-preview/managedUnsupportedVMSizesGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py index f049d6e883b5..1c0bed7e8fc8 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/managed_unsupported_vm_sizes_list_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.managed_unsupported_vm_sizes.list( @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/managedUnsupportedVMSizesList_example.json +# x-ms-original-file: 2025-03-01-preview/managedUnsupportedVMSizesList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py index eb9097950ca0..8baf7c346145 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.node_types.begin_delete( @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypeDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypeDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py index 11e133caf595..b27c2fc174ee 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.get( @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypeGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypeGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py index 38750fabc7fa..c463a4a4865b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.list_by_managed_clusters( @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypeListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypeListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py index 08d1037c9f89..7e0a296af5f9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_auto_scale_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_update( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePatchOperationAutoScale_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePatchOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py index b5ed40f8fdf2..ee73d449ff8e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_update( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py index 1b9de1b05027..a625f9f35d93 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_auto_scale_example.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -86,6 +87,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationAutoScale_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationAutoScale_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py index e8af53746d36..89cdb0241821 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_image_example.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationCustomImage_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationCustomImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py index e3cc87b110ba..3e9794de309a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_custom_shared_galleries_image_example.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -47,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationCustomSharedGalleriesImage_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationCustomSharedGalleriesImage_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py index 55e24318bdb9..290fd5adcd3a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_dedicated_host_example.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -55,6 +56,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationDedicatedHost_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationDedicatedHost_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py index 677489426d16..3bc7dd8b981f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_max.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -104,7 +105,8 @@ def main(): "natGatewayId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/natGateways/myNatGateway", "placementProperties": {"HasSSD": "true", "NodeColor": "green", "SomeProperty": "5"}, "secureBootEnabled": True, - "securityType": "TrustedLaunch", + "securityEncryptionType": "DiskWithVMGuestState", + "securityType": "ConfidentialVM", "serviceArtifactReferenceId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Compute/galleries/myGallery/serviceArtifacts/myServiceArtifact/vmArtifactsProfiles/myVmArtifactProfile", "spotRestoreTimeout": "PT30M", "subnetId": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resRg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1", @@ -167,6 +169,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperation_example_max.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py index 7f8584771d20..0e09a17ca80e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_example_min.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperation_example_min.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py index 80e17292dd48..cf61ad8dcbea 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_stateless_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -65,6 +65,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationStateless_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationStateless_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py index 2434f70cd598..feca124b4cd0 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_put_operation_vm_image_plan_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_types.begin_create_or_update( @@ -55,6 +55,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypePutOperationVmImagePlan_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypePutOperationVmImagePlan_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py index 1043c798dd64..65de68e75981 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/node_type_skus_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.node_type_skus.list( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/NodeTypeSkusListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/NodeTypeSkusListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_results_get_example.py similarity index 77% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_results_get_example.py index f855fc4e7a46..4e08ee9fe9cb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_result.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_results_get_example.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. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicefabricmanagedclusters # USAGE - python long_running_operation_result.py + python operation_results_get_example.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, @@ -27,15 +27,15 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) - client.operation_results.get( + client.operation_results.begin_get( location="eastus", operation_id="00000000-0000-0000-0000-000000001234", - ) + ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/Long_running_operation_result.json +# x-ms-original-file: 2025-03-01-preview/OperationResultsGet_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_failed_example.py similarity index 79% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_failed_example.py index 6c7bb741faf1..80b9520508c2 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_failed.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_failed_example.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. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicefabricmanagedclusters # USAGE - python long_running_operation_status_failed.py + python operation_status_failed_example.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, @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/Long_running_operation_status_failed.json +# x-ms-original-file: 2025-03-01-preview/OperationStatusFailed_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_succeeded_example.py similarity index 78% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_succeeded_example.py index b15fb0ca0135..d7b78ad26c61 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/long_running_operation_status_succeeded.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operation_status_succeeded_example.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. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicefabricmanagedclusters # USAGE - python long_running_operation_status_succeeded.py + python operation_status_succeeded_example.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, @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.operation_status.get( @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/Long_running_operation_status_succeeded.json +# x-ms-original-file: 2025-03-01-preview/OperationStatusSucceeded_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_list_example.py similarity index 80% rename from sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py rename to sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_list_example.py index 1da288ca38bf..ac2b929084b5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/operations_list_example.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. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-servicefabricmanagedclusters # USAGE - python operations_example.py + python operations_list_example.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, @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.operations.list() @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/Operations_example.json +# x-ms-original-file: 2025-03-01-preview/OperationsList_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_example.py new file mode 100644 index 000000000000..1ef17c2807f3 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_example.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.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python redeploy_nodes_example.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 = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.node_types.begin_redeploy( + resource_group_name="resRg", + cluster_name="myCluster", + node_type_name="BE", + parameters={"nodes": ["BE_0", "BE_1"]}, + ).result() + + +# x-ms-original-file: 2025-03-01-preview/RedeployNodes_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_ud_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_ud_example.py new file mode 100644 index 000000000000..3a7c3d8ffb07 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/redeploy_nodes_ud_example.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.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python redeploy_nodes_ud_example.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 = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.node_types.begin_redeploy( + resource_group_name="resRg", + cluster_name="myCluster", + node_type_name="BE", + parameters={"updateType": "ByUpgradeDomain"}, + ).result() + + +# x-ms-original-file: 2025-03-01-preview/RedeployNodes_UD_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py index 44b51342ecf2..7efaf8fbea50 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.node_types.begin_reimage( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ReimageNodes_example.json +# x-ms-original-file: 2025-03-01-preview/ReimageNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py index 94bd1f540921..e1be4d01de42 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/reimage_nodes_ud_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.node_types.begin_reimage( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ReimageNodes_UD_example.json +# x-ms-original-file: 2025-03-01-preview/ReimageNodes_UD_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py index 4b66ed911c3f..6cde6c00f222 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/restart_nodes_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.node_types.begin_restart( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/RestartNodes_example.json +# x-ms-original-file: 2025-03-01-preview/RestartNodes_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py index 95345baf30dc..bca7a69b0d81 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_delete_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) client.services.begin_delete( @@ -38,6 +38,6 @@ def main(): ).result() -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServiceDeleteOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ServiceDeleteOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py index 39a1a144087a..38627a06f5a1 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_get_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.get( @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServiceGetOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ServiceGetOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py index c9ad1088fa7f..9fc183ff10d4 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_list_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.list_by_applications( @@ -39,6 +39,6 @@ def main(): print(item) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServiceListOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ServiceListOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py index a551382d7676..8c32849e280e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_patch_operation_example.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.update( @@ -40,6 +40,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServicePatchOperation_example.json +# x-ms-original-file: 2025-03-01-preview/ServicePatchOperation_example.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py index 6abea8fb061d..0345099dcd1e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_max.py @@ -1,8 +1,9 @@ +# 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. # -------------------------------------------------------------------------- @@ -27,7 +28,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -80,6 +81,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServicePutOperation_example_max.json +# x-ms-original-file: 2025-03-01-preview/ServicePutOperation_example_max.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py index a5df22eff351..b7cf9d144843 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/service_put_operation_example_min.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. # -------------------------------------------------------------------------- @@ -27,7 +27,7 @@ def main(): client = ServiceFabricManagedClustersManagementClient( credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", + subscription_id="SUBSCRIPTION_ID", ) response = client.services.begin_create_or_update( @@ -48,6 +48,6 @@ def main(): print(response) -# x-ms-original-file: specification/servicefabricmanagedclusters/resource-manager/Microsoft.ServiceFabric/preview/2024-09-01-preview/examples/ServicePutOperation_example_min.json +# x-ms-original-file: 2025-03-01-preview/ServicePutOperation_example_min.json if __name__ == "__main__": main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/start_nodes_example.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/start_nodes_example.py new file mode 100644 index 000000000000..9ed987f54c98 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_samples/start_nodes_example.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.servicefabricmanagedclusters import ServiceFabricManagedClustersManagementClient + +""" +# PREREQUISITES + pip install azure-identity + pip install azure-mgmt-servicefabricmanagedclusters +# USAGE + python start_nodes_example.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 = ServiceFabricManagedClustersManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.node_types.begin_start( + resource_group_name="resRg", + cluster_name="myCluster", + node_type_name="BE", + parameters={"nodes": ["BE_0", "BE_1"]}, + ).result() + + +# x-ms-original-file: 2025-03-01-preview/StartNodes_example.json +if __name__ == "__main__": + main() diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/conftest.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/conftest.py index b996bb4dab29..0607cde4a27e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/conftest.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations.py index 8788b7d94dc4..0d4841e09520 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_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_application_type_versions_get(self, resource_group): cluster_name="str", application_type_name="str", version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -41,11 +40,10 @@ def test_application_type_versions_begin_create_or_update(self, resource_group): application_type_name="str", version="str", parameters={ - "appPackageUrl": "str", "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"appPackageUrl": "str", "provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -57,7 +55,6 @@ def test_application_type_versions_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -72,7 +69,6 @@ def test_application_type_versions_update(self, resource_group): application_type_name="str", version="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -86,7 +82,6 @@ def test_application_type_versions_begin_delete(self, resource_group): cluster_name="str", application_type_name="str", version="str", - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -99,7 +94,6 @@ def test_application_type_versions_list_by_application_types(self, resource_grou resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations_async.py index f8fd5c78a762..b1767fdba89a 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_type_versions_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_application_type_versions_get(self, resource_group): cluster_name="str", application_type_name="str", version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -43,11 +42,10 @@ async def test_application_type_versions_begin_create_or_update(self, resource_g application_type_name="str", version="str", parameters={ - "appPackageUrl": "str", "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"appPackageUrl": "str", "provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -59,7 +57,6 @@ async def test_application_type_versions_begin_create_or_update(self, resource_g "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -75,7 +72,6 @@ async def test_application_type_versions_update(self, resource_group): application_type_name="str", version="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -90,7 +86,6 @@ async def test_application_type_versions_begin_delete(self, resource_group): cluster_name="str", application_type_name="str", version="str", - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -104,7 +99,6 @@ async def test_application_type_versions_list_by_application_types(self, resourc resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations.py index 1fa85bbf7528..bb1ba7120e28 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_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_application_types_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -42,7 +41,7 @@ def test_application_types_create_or_update(self, resource_group): "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -54,7 +53,6 @@ def test_application_types_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -68,7 +66,6 @@ def test_application_types_update(self, resource_group): cluster_name="str", application_type_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -81,7 +78,6 @@ def test_application_types_begin_delete(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -93,7 +89,6 @@ def test_application_types_list(self, resource_group): response = self.client.application_types.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations_async.py index bd7cb8634d0e..99b85be8aac9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_application_types_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_application_types_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -43,7 +42,7 @@ async def test_application_types_create_or_update(self, resource_group): "id": "str", "location": "str", "name": "str", - "provisioningState": "str", + "properties": {"provisioningState": "str"}, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -55,7 +54,6 @@ async def test_application_types_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -69,7 +67,6 @@ async def test_application_types_update(self, resource_group): cluster_name="str", application_type_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -83,7 +80,6 @@ async def test_application_types_begin_delete(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_type_name="str", - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -96,7 +92,6 @@ async def test_application_types_list(self, resource_group): response = self.client.application_types.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations.py index a13480f95854..dabb8a9e3765 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_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,46 +18,6 @@ class TestServiceFabricManagedClustersManagementApplicationsOperations(AzureMgmt def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_applications_begin_read_upgrade(self, resource_group): - response = self.client.applications.begin_read_upgrade( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - api_version="2024-09-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_applications_begin_start_rollback(self, resource_group): - response = self.client.applications.begin_start_rollback( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - api_version="2024-09-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_applications_begin_resume_upgrade(self, resource_group): - response = self.client.applications.begin_resume_upgrade( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - parameters={"upgradeDomainName": "str"}, - api_version="2024-09-01-preview", - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_applications_get(self, resource_group): @@ -65,7 +25,6 @@ def test_applications_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -87,10 +46,44 @@ def test_applications_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "location": "str", - "managedIdentities": [{"name": "str", "principalId": "str"}], "name": "str", - "parameters": {"str": "str"}, - "provisioningState": "str", + "properties": { + "managedIdentities": [{"name": "str", "principalId": "str"}], + "parameters": {"str": "str"}, + "provisioningState": "str", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": bool, + "maxPercentUnhealthyDeployedApplications": 0, + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": 0, + "maxPercentUnhealthyReplicasPerPartition": 0, + "maxPercentUnhealthyServices": 0, + }, + "serviceTypeHealthPolicyMap": { + "str": { + "maxPercentUnhealthyPartitionsPerService": 0, + "maxPercentUnhealthyReplicasPerPartition": 0, + "maxPercentUnhealthyServices": 0, + } + }, + }, + "forceRestart": bool, + "instanceCloseDelayDuration": 0, + "recreateApplication": bool, + "rollingUpgradeMonitoringPolicy": { + "failureAction": "str", + "healthCheckRetryTimeout": "str", + "healthCheckStableDuration": "str", + "healthCheckWaitDuration": "str", + "upgradeDomainTimeout": "str", + "upgradeTimeout": "str", + }, + "upgradeMode": "str", + "upgradeReplicaSetCheckTimeout": 0, + }, + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -101,40 +94,7 @@ def test_applications_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": bool, - "maxPercentUnhealthyDeployedApplications": 0, - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": 0, - "maxPercentUnhealthyReplicasPerPartition": 0, - "maxPercentUnhealthyServices": 0, - }, - "serviceTypeHealthPolicyMap": { - "str": { - "maxPercentUnhealthyPartitionsPerService": 0, - "maxPercentUnhealthyReplicasPerPartition": 0, - "maxPercentUnhealthyServices": 0, - } - }, - }, - "forceRestart": False, - "instanceCloseDelayDuration": 0, - "recreateApplication": bool, - "rollingUpgradeMonitoringPolicy": { - "failureAction": "str", - "healthCheckRetryTimeout": "str", - "healthCheckStableDuration": "str", - "healthCheckWaitDuration": "str", - "upgradeDomainTimeout": "str", - "upgradeTimeout": "str", - }, - "upgradeMode": "str", - "upgradeReplicaSetCheckTimeout": 0, - }, - "version": "str", }, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -148,7 +108,6 @@ def test_applications_update(self, resource_group): cluster_name="str", application_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -161,7 +120,6 @@ def test_applications_begin_delete(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -173,8 +131,44 @@ def test_applications_list(self, resource_group): response = self.client.applications.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_applications_begin_read_upgrade(self, resource_group): + response = self.client.applications.begin_read_upgrade( + resource_group_name=resource_group.name, + cluster_name="str", + application_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_applications_begin_resume_upgrade(self, resource_group): + response = self.client.applications.begin_resume_upgrade( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + parameters={"upgradeDomainName": "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_applications_begin_start_rollback(self, resource_group): + response = self.client.applications.begin_start_rollback( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations_async.py index 7a39517753a0..da7e2b16018d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_applications_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,52 +19,6 @@ class TestServiceFabricManagedClustersManagementApplicationsOperationsAsync(Azur def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_applications_begin_read_upgrade(self, resource_group): - response = await ( - await self.client.applications.begin_read_upgrade( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - api_version="2024-09-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_applications_begin_start_rollback(self, resource_group): - response = await ( - await self.client.applications.begin_start_rollback( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - api_version="2024-09-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_applications_begin_resume_upgrade(self, resource_group): - response = await ( - await self.client.applications.begin_resume_upgrade( - resource_group_name=resource_group.name, - cluster_name="str", - application_name="str", - parameters={"upgradeDomainName": "str"}, - api_version="2024-09-01-preview", - ) - ).result() # call '.result()' to poll until service return final result - - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_applications_get(self, resource_group): @@ -72,7 +26,6 @@ async def test_applications_get(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -95,10 +48,44 @@ async def test_applications_begin_create_or_update(self, resource_group): "userAssignedIdentities": {"str": {"clientId": "str", "principalId": "str"}}, }, "location": "str", - "managedIdentities": [{"name": "str", "principalId": "str"}], "name": "str", - "parameters": {"str": "str"}, - "provisioningState": "str", + "properties": { + "managedIdentities": [{"name": "str", "principalId": "str"}], + "parameters": {"str": "str"}, + "provisioningState": "str", + "upgradePolicy": { + "applicationHealthPolicy": { + "considerWarningAsError": bool, + "maxPercentUnhealthyDeployedApplications": 0, + "defaultServiceTypeHealthPolicy": { + "maxPercentUnhealthyPartitionsPerService": 0, + "maxPercentUnhealthyReplicasPerPartition": 0, + "maxPercentUnhealthyServices": 0, + }, + "serviceTypeHealthPolicyMap": { + "str": { + "maxPercentUnhealthyPartitionsPerService": 0, + "maxPercentUnhealthyReplicasPerPartition": 0, + "maxPercentUnhealthyServices": 0, + } + }, + }, + "forceRestart": bool, + "instanceCloseDelayDuration": 0, + "recreateApplication": bool, + "rollingUpgradeMonitoringPolicy": { + "failureAction": "str", + "healthCheckRetryTimeout": "str", + "healthCheckStableDuration": "str", + "healthCheckWaitDuration": "str", + "upgradeDomainTimeout": "str", + "upgradeTimeout": "str", + }, + "upgradeMode": "str", + "upgradeReplicaSetCheckTimeout": 0, + }, + "version": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -109,40 +96,7 @@ async def test_applications_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradePolicy": { - "applicationHealthPolicy": { - "considerWarningAsError": bool, - "maxPercentUnhealthyDeployedApplications": 0, - "defaultServiceTypeHealthPolicy": { - "maxPercentUnhealthyPartitionsPerService": 0, - "maxPercentUnhealthyReplicasPerPartition": 0, - "maxPercentUnhealthyServices": 0, - }, - "serviceTypeHealthPolicyMap": { - "str": { - "maxPercentUnhealthyPartitionsPerService": 0, - "maxPercentUnhealthyReplicasPerPartition": 0, - "maxPercentUnhealthyServices": 0, - } - }, - }, - "forceRestart": False, - "instanceCloseDelayDuration": 0, - "recreateApplication": bool, - "rollingUpgradeMonitoringPolicy": { - "failureAction": "str", - "healthCheckRetryTimeout": "str", - "healthCheckStableDuration": "str", - "healthCheckWaitDuration": "str", - "upgradeDomainTimeout": "str", - "upgradeTimeout": "str", - }, - "upgradeMode": "str", - "upgradeReplicaSetCheckTimeout": 0, - }, - "version": "str", }, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -157,7 +111,6 @@ async def test_applications_update(self, resource_group): cluster_name="str", application_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -171,7 +124,6 @@ async def test_applications_begin_delete(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -184,8 +136,50 @@ async def test_applications_list(self, resource_group): response = self.client.applications.list( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_applications_begin_read_upgrade(self, resource_group): + response = await ( + await self.client.applications.begin_read_upgrade( + resource_group_name=resource_group.name, + cluster_name="str", + application_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_applications_begin_resume_upgrade(self, resource_group): + response = await ( + await self.client.applications.begin_resume_upgrade( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + parameters={"upgradeDomainName": "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_applications_begin_start_rollback(self, resource_group): + response = await ( + await self.client.applications.begin_start_rollback( + resource_group_name=resource_group.name, + cluster_name="str", + application_name="str", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations.py index f1e9b7fae552..61995e7fe1ae 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_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_managed_apply_maintenance_window_post(self, resource_group): response = self.client.managed_apply_maintenance_window.post( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations_async.py index a549b3d99bb3..bb2304c64d8e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_apply_maintenance_window_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_managed_apply_maintenance_window_post(self, resource_group): response = await self.client.managed_apply_maintenance_window.post( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations.py index 725e6f2f400c..01a9001db097 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_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_managed_az_resiliency_status_get(self, resource_group): response = self.client.managed_az_resiliency_status.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations_async.py index 0bbde15d1c7c..7f32b664d512 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_az_resiliency_status_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_managed_az_resiliency_status_get(self, resource_group): response = await self.client.managed_az_resiliency_status.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations.py index e874da33e195..774e6c77be1f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_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_managed_cluster_version_get(self, resource_group): response = self.client.managed_cluster_version.get( location="str", cluster_version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -32,12 +31,9 @@ def test_managed_cluster_version_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_managed_cluster_version_get_by_environment(self, resource_group): - response = self.client.managed_cluster_version.get_by_environment( + def test_managed_cluster_version_list(self, resource_group): + response = self.client.managed_cluster_version.list( location="str", - environment="str", - cluster_version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -45,10 +41,11 @@ def test_managed_cluster_version_get_by_environment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_managed_cluster_version_list(self, resource_group): - response = self.client.managed_cluster_version.list( + def test_managed_cluster_version_get_by_environment(self, resource_group): + response = self.client.managed_cluster_version.get_by_environment( location="str", - api_version="2024-09-01-preview", + environment="str", + cluster_version="str", ) # please add some check logic here by yourself @@ -60,7 +57,6 @@ def test_managed_cluster_version_list_by_environment(self, resource_group): response = self.client.managed_cluster_version.list_by_environment( location="str", environment="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations_async.py index f6aa2ae67f01..6a687928d08b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_cluster_version_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_managed_cluster_version_get(self, resource_group): response = await self.client.managed_cluster_version.get( location="str", cluster_version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -33,12 +32,9 @@ async def test_managed_cluster_version_get(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_managed_cluster_version_get_by_environment(self, resource_group): - response = await self.client.managed_cluster_version.get_by_environment( + async def test_managed_cluster_version_list(self, resource_group): + response = await self.client.managed_cluster_version.list( location="str", - environment="str", - cluster_version="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -46,10 +42,11 @@ async def test_managed_cluster_version_get_by_environment(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_managed_cluster_version_list(self, resource_group): - response = await self.client.managed_cluster_version.list( + async def test_managed_cluster_version_get_by_environment(self, resource_group): + response = await self.client.managed_cluster_version.get_by_environment( location="str", - api_version="2024-09-01-preview", + environment="str", + cluster_version="str", ) # please add some check logic here by yourself @@ -61,7 +58,6 @@ async def test_managed_cluster_version_list_by_environment(self, resource_group) response = await self.client.managed_cluster_version.list_by_environment( location="str", environment="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations.py index 716452abdf57..deb2d8e99a70 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_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,34 +18,12 @@ class TestServiceFabricManagedClustersManagementManagedClustersOperations(AzureM def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_managed_clusters_list_by_resource_group(self, resource_group): - response = self.client.managed_clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-09-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_managed_clusters_list_by_subscription(self, resource_group): - response = self.client.managed_clusters.list_by_subscription( - api_version="2024-09-01-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_managed_clusters_get(self, resource_group): response = self.client.managed_clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -60,81 +38,108 @@ def test_managed_clusters_begin_create_or_update(self, resource_group): parameters={ "location": "str", "sku": {"name": "str"}, - "addonFeatures": ["str"], - "adminPassword": "str", - "adminUserName": "str", - "allocatedOutboundPorts": 0, - "allowRdpAccess": bool, - "applicationTypeVersionsCleanupPolicy": {"maxUnusedVersionsToKeep": 0}, - "autoGeneratedDomainNameLabelScope": "str", - "auxiliarySubnets": [ - { - "name": "str", - "enableIpv6": bool, - "networkSecurityGroupId": "str", - "privateEndpointNetworkPolicies": "str", - "privateLinkServiceNetworkPolicies": "str", - } - ], - "azureActiveDirectory": {"clientApplication": "str", "clusterApplication": "str", "tenantId": "str"}, - "clientConnectionPort": 19000, - "clients": [{"isAdmin": bool, "commonName": "str", "issuerThumbprint": "str", "thumbprint": "str"}], - "clusterCertificateThumbprints": ["str"], - "clusterCodeVersion": "str", - "clusterId": "str", - "clusterState": "str", - "clusterUpgradeCadence": "str", - "clusterUpgradeMode": "Automatic", - "ddosProtectionPlanId": "str", - "dnsName": "str", - "enableAutoOSUpgrade": bool, - "enableHttpGatewayExclusiveAuthMode": bool, - "enableIpv6": bool, - "enableServicePublicIP": bool, "etag": "str", - "fabricSettings": [{"name": "str", "parameters": [{"name": "str", "value": "str"}]}], - "fqdn": "str", - "httpGatewayConnectionPort": 19080, - "httpGatewayTokenAuthConnectionPort": 0, "id": "str", - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "ipv4Address": "str", - "ipv6Address": "str", - "loadBalancingRules": [ - { - "backendPort": 0, - "frontendPort": 0, - "probeProtocol": "str", - "protocol": "str", - "loadDistribution": "str", - "probePort": 0, - "probeRequestPath": "str", - } - ], "name": "str", - "networkSecurityRules": [ - { - "access": "str", - "direction": "str", - "name": "str", - "priority": 0, - "protocol": "str", - "description": "str", - "destinationAddressPrefix": "str", - "destinationAddressPrefixes": ["str"], - "destinationPortRange": "str", - "destinationPortRanges": ["str"], - "sourceAddressPrefix": "str", - "sourceAddressPrefixes": ["str"], - "sourcePortRange": "str", - "sourcePortRanges": ["str"], - } - ], - "provisioningState": "str", - "publicIPPrefixId": "str", - "publicIPv6PrefixId": "str", - "serviceEndpoints": [{"service": "str", "locations": ["str"]}], - "subnetId": "str", + "properties": { + "adminUserName": "str", + "dnsName": "str", + "VMImage": "str", + "addonFeatures": ["str"], + "adminPassword": "str", + "allocatedOutboundPorts": 0, + "allowRdpAccess": bool, + "applicationTypeVersionsCleanupPolicy": {"maxUnusedVersionsToKeep": 0}, + "autoGeneratedDomainNameLabelScope": "str", + "auxiliarySubnets": [ + { + "name": "str", + "enableIpv6": bool, + "networkSecurityGroupId": "str", + "privateEndpointNetworkPolicies": "str", + "privateLinkServiceNetworkPolicies": "str", + } + ], + "azureActiveDirectory": { + "clientApplication": "str", + "clusterApplication": "str", + "tenantId": "str", + }, + "clientConnectionPort": 0, + "clients": [{"isAdmin": bool, "commonName": "str", "issuerThumbprint": "str", "thumbprint": "str"}], + "clusterCertificateThumbprints": ["str"], + "clusterCodeVersion": "str", + "clusterId": "str", + "clusterState": "str", + "clusterUpgradeCadence": "str", + "clusterUpgradeMode": "str", + "ddosProtectionPlanId": "str", + "enableAutoOSUpgrade": bool, + "enableHttpGatewayExclusiveAuthMode": bool, + "enableIpv6": bool, + "enableServicePublicIP": bool, + "fabricSettings": [{"name": "str", "parameters": [{"name": "str", "value": "str"}]}], + "fqdn": "str", + "httpGatewayConnectionPort": 0, + "httpGatewayTokenAuthConnectionPort": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "ipv4Address": "str", + "ipv6Address": "str", + "loadBalancingRules": [ + { + "backendPort": 0, + "frontendPort": 0, + "probeProtocol": "str", + "protocol": "str", + "loadDistribution": "str", + "probePort": 0, + "probeRequestPath": "str", + } + ], + "networkSecurityRules": [ + { + "access": "str", + "direction": "str", + "name": "str", + "priority": 0, + "protocol": "str", + "description": "str", + "destinationAddressPrefix": "str", + "destinationAddressPrefixes": ["str"], + "destinationPortRange": "str", + "destinationPortRanges": ["str"], + "sourceAddressPrefix": "str", + "sourceAddressPrefixes": ["str"], + "sourcePortRange": "str", + "sourcePortRanges": ["str"], + } + ], + "provisioningState": "str", + "publicIPPrefixId": "str", + "publicIPv6PrefixId": "str", + "serviceEndpoints": [{"service": "str", "locations": ["str"]}], + "subnetId": "str", + "upgradeDescription": { + "deltaHealthPolicy": { + "maxPercentDeltaUnhealthyNodes": 0, + "maxPercentDeltaUnhealthyApplications": 0, + "maxPercentUpgradeDomainDeltaUnhealthyNodes": 0, + }, + "forceRestart": bool, + "healthPolicy": {"maxPercentUnhealthyApplications": 0, "maxPercentUnhealthyNodes": 0}, + "monitoringPolicy": { + "healthCheckRetryTimeout": "str", + "healthCheckStableDuration": "str", + "healthCheckWaitDuration": "str", + "upgradeDomainTimeout": "str", + "upgradeTimeout": "str", + }, + "upgradeReplicaSetCheckTimeout": "str", + }, + "useCustomVnet": bool, + "zonalResiliency": bool, + "zonalUpdateMode": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -145,28 +150,7 @@ def test_managed_clusters_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradeDescription": { - "deltaHealthPolicy": { - "maxPercentDeltaUnhealthyNodes": 0, - "maxPercentDeltaUnhealthyApplications": 0, - "maxPercentUpgradeDomainDeltaUnhealthyNodes": 0, - }, - "forceRestart": bool, - "healthPolicy": {"maxPercentUnhealthyApplications": 0, "maxPercentUnhealthyNodes": 0}, - "monitoringPolicy": { - "healthCheckRetryTimeout": "str", - "healthCheckStableDuration": "str", - "healthCheckWaitDuration": "str", - "upgradeDomainTimeout": "str", - "upgradeTimeout": "str", - }, - "upgradeReplicaSetCheckTimeout": "str", - }, - "useCustomVnet": bool, - "zonalResiliency": False, - "zonalUpdateMode": "str", }, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -179,7 +163,6 @@ def test_managed_clusters_update(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -191,7 +174,71 @@ def test_managed_clusters_begin_delete(self, resource_group): response = self.client.managed_clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_clusters_list_by_resource_group(self, resource_group): + response = self.client.managed_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_clusters_list_by_subscription(self, resource_group): + response = self.client.managed_clusters.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_managed_clusters_get_fault_simulation(self, resource_group): + response = self.client.managed_clusters.get_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"simulationId": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_managed_clusters_list_fault_simulation(self, resource_group): + response = self.client.managed_clusters.list_fault_simulation( + resource_group_name=resource_group.name, + cluster_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_managed_clusters_begin_start_fault_simulation(self, resource_group): + response = self.client.managed_clusters.begin_start_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"parameters": "fault_simulation_content"}, + ).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_managed_clusters_begin_stop_fault_simulation(self, resource_group): + response = self.client.managed_clusters.begin_stop_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"simulationId": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations_async.py index fc1f2e9c4977..5e65d1b2e16c 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_clusters_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,34 +19,12 @@ class TestServiceFabricManagedClustersManagementManagedClustersOperationsAsync(A def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient, is_async=True) - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_managed_clusters_list_by_resource_group(self, resource_group): - response = self.client.managed_clusters.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2024-09-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_managed_clusters_list_by_subscription(self, resource_group): - response = self.client.managed_clusters.list_by_subscription( - api_version="2024-09-01-preview", - ) - result = [r async for r in response] - # please add some check logic here by yourself - # ... - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_managed_clusters_get(self, resource_group): response = await self.client.managed_clusters.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -62,85 +40,110 @@ async def test_managed_clusters_begin_create_or_update(self, resource_group): parameters={ "location": "str", "sku": {"name": "str"}, - "addonFeatures": ["str"], - "adminPassword": "str", - "adminUserName": "str", - "allocatedOutboundPorts": 0, - "allowRdpAccess": bool, - "applicationTypeVersionsCleanupPolicy": {"maxUnusedVersionsToKeep": 0}, - "autoGeneratedDomainNameLabelScope": "str", - "auxiliarySubnets": [ - { - "name": "str", - "enableIpv6": bool, - "networkSecurityGroupId": "str", - "privateEndpointNetworkPolicies": "str", - "privateLinkServiceNetworkPolicies": "str", - } - ], - "azureActiveDirectory": { - "clientApplication": "str", - "clusterApplication": "str", - "tenantId": "str", - }, - "clientConnectionPort": 19000, - "clients": [{"isAdmin": bool, "commonName": "str", "issuerThumbprint": "str", "thumbprint": "str"}], - "clusterCertificateThumbprints": ["str"], - "clusterCodeVersion": "str", - "clusterId": "str", - "clusterState": "str", - "clusterUpgradeCadence": "str", - "clusterUpgradeMode": "Automatic", - "ddosProtectionPlanId": "str", - "dnsName": "str", - "enableAutoOSUpgrade": bool, - "enableHttpGatewayExclusiveAuthMode": bool, - "enableIpv6": bool, - "enableServicePublicIP": bool, "etag": "str", - "fabricSettings": [{"name": "str", "parameters": [{"name": "str", "value": "str"}]}], - "fqdn": "str", - "httpGatewayConnectionPort": 19080, - "httpGatewayTokenAuthConnectionPort": 0, "id": "str", - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "ipv4Address": "str", - "ipv6Address": "str", - "loadBalancingRules": [ - { - "backendPort": 0, - "frontendPort": 0, - "probeProtocol": "str", - "protocol": "str", - "loadDistribution": "str", - "probePort": 0, - "probeRequestPath": "str", - } - ], "name": "str", - "networkSecurityRules": [ - { - "access": "str", - "direction": "str", - "name": "str", - "priority": 0, - "protocol": "str", - "description": "str", - "destinationAddressPrefix": "str", - "destinationAddressPrefixes": ["str"], - "destinationPortRange": "str", - "destinationPortRanges": ["str"], - "sourceAddressPrefix": "str", - "sourceAddressPrefixes": ["str"], - "sourcePortRange": "str", - "sourcePortRanges": ["str"], - } - ], - "provisioningState": "str", - "publicIPPrefixId": "str", - "publicIPv6PrefixId": "str", - "serviceEndpoints": [{"service": "str", "locations": ["str"]}], - "subnetId": "str", + "properties": { + "adminUserName": "str", + "dnsName": "str", + "VMImage": "str", + "addonFeatures": ["str"], + "adminPassword": "str", + "allocatedOutboundPorts": 0, + "allowRdpAccess": bool, + "applicationTypeVersionsCleanupPolicy": {"maxUnusedVersionsToKeep": 0}, + "autoGeneratedDomainNameLabelScope": "str", + "auxiliarySubnets": [ + { + "name": "str", + "enableIpv6": bool, + "networkSecurityGroupId": "str", + "privateEndpointNetworkPolicies": "str", + "privateLinkServiceNetworkPolicies": "str", + } + ], + "azureActiveDirectory": { + "clientApplication": "str", + "clusterApplication": "str", + "tenantId": "str", + }, + "clientConnectionPort": 0, + "clients": [ + {"isAdmin": bool, "commonName": "str", "issuerThumbprint": "str", "thumbprint": "str"} + ], + "clusterCertificateThumbprints": ["str"], + "clusterCodeVersion": "str", + "clusterId": "str", + "clusterState": "str", + "clusterUpgradeCadence": "str", + "clusterUpgradeMode": "str", + "ddosProtectionPlanId": "str", + "enableAutoOSUpgrade": bool, + "enableHttpGatewayExclusiveAuthMode": bool, + "enableIpv6": bool, + "enableServicePublicIP": bool, + "fabricSettings": [{"name": "str", "parameters": [{"name": "str", "value": "str"}]}], + "fqdn": "str", + "httpGatewayConnectionPort": 0, + "httpGatewayTokenAuthConnectionPort": 0, + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "ipv4Address": "str", + "ipv6Address": "str", + "loadBalancingRules": [ + { + "backendPort": 0, + "frontendPort": 0, + "probeProtocol": "str", + "protocol": "str", + "loadDistribution": "str", + "probePort": 0, + "probeRequestPath": "str", + } + ], + "networkSecurityRules": [ + { + "access": "str", + "direction": "str", + "name": "str", + "priority": 0, + "protocol": "str", + "description": "str", + "destinationAddressPrefix": "str", + "destinationAddressPrefixes": ["str"], + "destinationPortRange": "str", + "destinationPortRanges": ["str"], + "sourceAddressPrefix": "str", + "sourceAddressPrefixes": ["str"], + "sourcePortRange": "str", + "sourcePortRanges": ["str"], + } + ], + "provisioningState": "str", + "publicIPPrefixId": "str", + "publicIPv6PrefixId": "str", + "serviceEndpoints": [{"service": "str", "locations": ["str"]}], + "subnetId": "str", + "upgradeDescription": { + "deltaHealthPolicy": { + "maxPercentDeltaUnhealthyNodes": 0, + "maxPercentDeltaUnhealthyApplications": 0, + "maxPercentUpgradeDomainDeltaUnhealthyNodes": 0, + }, + "forceRestart": bool, + "healthPolicy": {"maxPercentUnhealthyApplications": 0, "maxPercentUnhealthyNodes": 0}, + "monitoringPolicy": { + "healthCheckRetryTimeout": "str", + "healthCheckStableDuration": "str", + "healthCheckWaitDuration": "str", + "upgradeDomainTimeout": "str", + "upgradeTimeout": "str", + }, + "upgradeReplicaSetCheckTimeout": "str", + }, + "useCustomVnet": bool, + "zonalResiliency": bool, + "zonalUpdateMode": "str", + }, "systemData": { "createdAt": "2020-02-20 00:00:00", "createdBy": "str", @@ -151,28 +154,7 @@ async def test_managed_clusters_begin_create_or_update(self, resource_group): }, "tags": {"str": "str"}, "type": "str", - "upgradeDescription": { - "deltaHealthPolicy": { - "maxPercentDeltaUnhealthyNodes": 0, - "maxPercentDeltaUnhealthyApplications": 0, - "maxPercentUpgradeDomainDeltaUnhealthyNodes": 0, - }, - "forceRestart": bool, - "healthPolicy": {"maxPercentUnhealthyApplications": 0, "maxPercentUnhealthyNodes": 0}, - "monitoringPolicy": { - "healthCheckRetryTimeout": "str", - "healthCheckStableDuration": "str", - "healthCheckWaitDuration": "str", - "upgradeDomainTimeout": "str", - "upgradeTimeout": "str", - }, - "upgradeReplicaSetCheckTimeout": "str", - }, - "useCustomVnet": bool, - "zonalResiliency": False, - "zonalUpdateMode": "str", }, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -186,7 +168,6 @@ async def test_managed_clusters_update(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -199,7 +180,75 @@ async def test_managed_clusters_begin_delete(self, resource_group): await self.client.managed_clusters.begin_delete( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", + ) + ).result() # call '.result()' to poll until service return final result + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_clusters_list_by_resource_group(self, resource_group): + response = self.client.managed_clusters.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_clusters_list_by_subscription(self, resource_group): + response = self.client.managed_clusters.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_managed_clusters_get_fault_simulation(self, resource_group): + response = await self.client.managed_clusters.get_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"simulationId": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_managed_clusters_list_fault_simulation(self, resource_group): + response = self.client.managed_clusters.list_fault_simulation( + resource_group_name=resource_group.name, + cluster_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_managed_clusters_begin_start_fault_simulation(self, resource_group): + response = await ( + await self.client.managed_clusters.begin_start_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"parameters": "fault_simulation_content"}, + ) + ).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_managed_clusters_begin_stop_fault_simulation(self, resource_group): + response = await ( + await self.client.managed_clusters.begin_stop_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + parameters={"simulationId": "str"}, ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations.py index f2977d6999f2..93904cb0fe4d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_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_managed_maintenance_window_status_get(self, resource_group): response = self.client.managed_maintenance_window_status.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations_async.py index 3ef305b2c979..e9ccb138d6fe 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_maintenance_window_status_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_managed_maintenance_window_status_get(self, resource_group): response = await self.client.managed_maintenance_window_status.get( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations.py index e19fcb1ae6b8..fffd751020d9 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_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,23 +20,21 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_managed_unsupported_vm_sizes_list(self, resource_group): - response = self.client.managed_unsupported_vm_sizes.list( + def test_managed_unsupported_vm_sizes_get(self, resource_group): + response = self.client.managed_unsupported_vm_sizes.get( location="str", - api_version="2024-09-01-preview", + vm_size="str", ) - result = [r for r in response] + # please add some check logic here by yourself # ... @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_managed_unsupported_vm_sizes_get(self, resource_group): - response = self.client.managed_unsupported_vm_sizes.get( + def test_managed_unsupported_vm_sizes_list(self, resource_group): + response = self.client.managed_unsupported_vm_sizes.list( location="str", - vm_size="str", - api_version="2024-09-01-preview", ) - + result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations_async.py index e22104a0a70f..83efbab8550f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_managed_unsupported_vm_sizes_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,23 +21,21 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_managed_unsupported_vm_sizes_list(self, resource_group): - response = self.client.managed_unsupported_vm_sizes.list( + async def test_managed_unsupported_vm_sizes_get(self, resource_group): + response = await self.client.managed_unsupported_vm_sizes.get( location="str", - api_version="2024-09-01-preview", + vm_size="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_managed_unsupported_vm_sizes_get(self, resource_group): - response = await self.client.managed_unsupported_vm_sizes.get( + async def test_managed_unsupported_vm_sizes_list(self, resource_group): + response = self.client.managed_unsupported_vm_sizes.list( location="str", - vm_size="str", - api_version="2024-09-01-preview", ) - + result = [r async for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations.py index 6462ddd0eb78..b0b5aad3c519 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_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_node_type_skus_list(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations_async.py index 5f854f62a80b..378ca931df2b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_type_skus_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_node_type_skus_list(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations.py index 4dd4dc5bb4b3..8e75d312e772 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_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,206 @@ class TestServiceFabricManagedClustersManagementNodeTypesOperations(AzureMgmtRec def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_node_types_get(self, resource_group): + response = self.client.node_types.get( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_node_types_begin_create_or_update(self, resource_group): + response = self.client.node_types.begin_create_or_update( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "isPrimary": bool, + "vmInstanceCount": 0, + "additionalDataDisks": [{"diskLetter": "str", "diskSizeGB": 0, "diskType": "str", "lun": 0}], + "additionalNetworkInterfaceConfigurations": [ + { + "ipConfigurations": [ + { + "name": "str", + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + }, + "subnet": {"id": "str"}, + } + ], + "name": "str", + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + } + ], + "applicationPorts": {"endPort": 0, "startPort": 0}, + "capacities": {"str": "str"}, + "computerNamePrefix": "str", + "dataDiskLetter": "str", + "dataDiskSizeGB": 0, + "dataDiskType": "str", + "dscpConfigurationId": "str", + "enableAcceleratedNetworking": bool, + "enableEncryptionAtHost": bool, + "enableNodePublicIP": bool, + "enableNodePublicIPv6": bool, + "enableOverProvisioning": bool, + "ephemeralPorts": {"endPort": 0, "startPort": 0}, + "evictionPolicy": "str", + "frontendConfigurations": [ + { + "applicationGatewayBackendAddressPoolId": "str", + "ipAddressType": "str", + "loadBalancerBackendAddressPoolId": "str", + "loadBalancerInboundNatPoolId": "str", + } + ], + "hostGroupId": "str", + "isSpotVM": bool, + "isStateless": bool, + "multiplePlacementGroups": bool, + "natConfigurations": [{"backendPort": 0, "frontendPortRangeEnd": 0, "frontendPortRangeStart": 0}], + "natGatewayId": "str", + "networkSecurityRules": [ + { + "access": "str", + "direction": "str", + "name": "str", + "priority": 0, + "protocol": "str", + "description": "str", + "destinationAddressPrefix": "str", + "destinationAddressPrefixes": ["str"], + "destinationPortRange": "str", + "destinationPortRanges": ["str"], + "sourceAddressPrefix": "str", + "sourceAddressPrefixes": ["str"], + "sourcePortRange": "str", + "sourcePortRanges": ["str"], + } + ], + "placementProperties": {"str": "str"}, + "provisioningState": "str", + "secureBootEnabled": bool, + "securityEncryptionType": "str", + "securityType": "str", + "serviceArtifactReferenceId": "str", + "spotRestoreTimeout": "str", + "subnetId": "str", + "useDefaultPublicLoadBalancer": bool, + "useEphemeralOSDisk": bool, + "useTempDataDisk": bool, + "vmApplications": [ + { + "packageReferenceId": "str", + "configurationReference": "str", + "enableAutomaticUpgrade": bool, + "order": 0, + "treatFailureAsDeploymentFailure": bool, + "vmGalleryTags": "str", + } + ], + "vmExtensions": [ + { + "name": "str", + "properties": { + "publisher": "str", + "type": "str", + "typeHandlerVersion": "str", + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "settings": {}, + "setupOrder": ["str"], + }, + } + ], + "vmImageOffer": "str", + "vmImagePlan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "vmImagePublisher": "str", + "vmImageResourceId": "str", + "vmImageSku": "str", + "vmImageVersion": "str", + "vmManagedIdentity": {"userAssignedIdentities": ["str"]}, + "vmSecrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "vmSetupActions": ["str"], + "vmSharedGalleryImageId": "str", + "vmSize": "str", + "zoneBalance": bool, + "zones": ["str"], + }, + "sku": {"capacity": 0, "name": "str", "tier": "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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_node_types_begin_update(self, resource_group): + response = self.client.node_types.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "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_node_types_begin_delete(self, resource_group): + response = self.client.node_types.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_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_node_types_list_by_managed_clusters(self, resource_group): response = self.client.node_types.list_by_managed_clusters( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself @@ -32,13 +225,38 @@ def test_node_types_list_by_managed_clusters(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_node_types_begin_restart(self, resource_group): - response = self.client.node_types.begin_restart( + def test_node_types_begin_deallocate(self, resource_group): + response = self.client.node_types.begin_deallocate( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"force": bool, "nodes": ["str"], "updateType": "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_node_types_begin_delete_node(self, resource_group): + response = self.client.node_types.begin_delete_node( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"force": bool, "nodes": ["str"], "updateType": "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_node_types_begin_redeploy(self, resource_group): + response = self.client.node_types.begin_redeploy( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -52,7 +270,6 @@ def test_node_types_begin_reimage(self, resource_group): cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -60,13 +277,12 @@ def test_node_types_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_node_types_begin_delete_node(self, resource_group): - response = self.client.node_types.begin_delete_node( + def test_node_types_begin_restart(self, resource_group): + response = self.client.node_types.begin_restart( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -74,166 +290,25 @@ def test_node_types_begin_delete_node(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_node_types_get(self, resource_group): - response = self.client.node_types.get( + def test_node_types_begin_start(self, resource_group): + response = self.client.node_types.begin_start( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - api_version="2024-09-01-preview", - ) + parameters={"force": bool, "nodes": ["str"], "updateType": "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_node_types_begin_create_or_update(self, resource_group): - response = self.client.node_types.begin_create_or_update( + def test_node_types_begin_start_fault_simulation(self, resource_group): + response = self.client.node_types.begin_start_fault_simulation( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - parameters={ - "additionalDataDisks": [ - {"diskLetter": "str", "diskSizeGB": 0, "diskType": "StandardSSD_LRS", "lun": 0} - ], - "additionalNetworkInterfaceConfigurations": [ - { - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "str", - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "IPv4", - }, - "subnet": {"id": "str"}, - } - ], - "name": "str", - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - } - ], - "applicationPorts": {"endPort": 0, "startPort": 0}, - "capacities": {"str": "str"}, - "computerNamePrefix": "str", - "dataDiskLetter": "str", - "dataDiskSizeGB": 0, - "dataDiskType": "StandardSSD_LRS", - "dscpConfigurationId": "str", - "enableAcceleratedNetworking": bool, - "enableEncryptionAtHost": False, - "enableNodePublicIP": bool, - "enableNodePublicIPv6": bool, - "enableOverProvisioning": bool, - "ephemeralPorts": {"endPort": 0, "startPort": 0}, - "evictionPolicy": "str", - "frontendConfigurations": [ - { - "applicationGatewayBackendAddressPoolId": "str", - "ipAddressType": "IPv4", - "loadBalancerBackendAddressPoolId": "str", - "loadBalancerInboundNatPoolId": "str", - } - ], - "hostGroupId": "str", - "id": "str", - "isPrimary": bool, - "isSpotVM": bool, - "isStateless": False, - "multiplePlacementGroups": False, - "name": "str", - "natConfigurations": [{"backendPort": 0, "frontendPortRangeEnd": 0, "frontendPortRangeStart": 0}], - "natGatewayId": "str", - "networkSecurityRules": [ - { - "access": "str", - "direction": "str", - "name": "str", - "priority": 0, - "protocol": "str", - "description": "str", - "destinationAddressPrefix": "str", - "destinationAddressPrefixes": ["str"], - "destinationPortRange": "str", - "destinationPortRanges": ["str"], - "sourceAddressPrefix": "str", - "sourceAddressPrefixes": ["str"], - "sourcePortRange": "str", - "sourcePortRanges": ["str"], - } - ], - "placementProperties": {"str": "str"}, - "provisioningState": "str", - "secureBootEnabled": bool, - "securityType": "str", - "serviceArtifactReferenceId": "str", - "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "spotRestoreTimeout": "str", - "subnetId": "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", - "useDefaultPublicLoadBalancer": bool, - "useEphemeralOSDisk": bool, - "useTempDataDisk": bool, - "vmApplications": [ - { - "packageReferenceId": "str", - "configurationReference": "str", - "enableAutomaticUpgrade": bool, - "order": 0, - "treatFailureAsDeploymentFailure": bool, - "vmGalleryTags": "str", - } - ], - "vmExtensions": [ - { - "name": "str", - "publisher": "str", - "type": "str", - "typeHandlerVersion": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "settings": {}, - "setupOrder": ["str"], - } - ], - "vmImageOffer": "str", - "vmImagePlan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "vmImagePublisher": "str", - "vmImageResourceId": "str", - "vmImageSku": "str", - "vmImageVersion": "str", - "vmInstanceCount": 0, - "vmManagedIdentity": {"userAssignedIdentities": ["str"]}, - "vmSecrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "vmSetupActions": ["str"], - "vmSharedGalleryImageId": "str", - "vmSize": "str", - "zones": ["str"], - }, - api_version="2024-09-01-preview", + parameters={"parameters": "fault_simulation_content"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -241,13 +316,12 @@ def test_node_types_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_node_types_begin_update(self, resource_group): - response = self.client.node_types.begin_update( + def test_node_types_begin_stop_fault_simulation(self, resource_group): + response = self.client.node_types.begin_stop_fault_simulation( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - parameters={"sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}}, - api_version="2024-09-01-preview", + parameters={"simulationId": "str"}, ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -255,13 +329,25 @@ def test_node_types_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_node_types_begin_delete(self, resource_group): - response = self.client.node_types.begin_delete( + def test_node_types_get_fault_simulation(self, resource_group): + response = self.client.node_types.get_fault_simulation( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - api_version="2024-09-01-preview", - ).result() # call '.result()' to poll until service return final result + parameters={"simulationId": "str"}, + ) # please add some check logic here by yourself # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_node_types_list_fault_simulation(self, resource_group): + response = self.client.node_types.list_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations_async.py index af8b72adc5fe..64050f606aaf 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_node_types_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,13 +19,214 @@ class TestServiceFabricManagedClustersManagementNodeTypesOperationsAsync(AzureMg def setup_method(self, method): self.client = self.create_mgmt_client(ServiceFabricManagedClustersManagementClient, is_async=True) + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_node_types_get(self, resource_group): + response = await self.client.node_types.get( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_node_types_begin_create_or_update(self, resource_group): + response = await ( + await self.client.node_types.begin_create_or_update( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={ + "id": "str", + "name": "str", + "properties": { + "isPrimary": bool, + "vmInstanceCount": 0, + "additionalDataDisks": [{"diskLetter": "str", "diskSizeGB": 0, "diskType": "str", "lun": 0}], + "additionalNetworkInterfaceConfigurations": [ + { + "ipConfigurations": [ + { + "name": "str", + "applicationGatewayBackendAddressPools": [{"id": "str"}], + "loadBalancerBackendAddressPools": [{"id": "str"}], + "loadBalancerInboundNatPools": [{"id": "str"}], + "privateIPAddressVersion": "str", + "publicIPAddressConfiguration": { + "name": "str", + "ipTags": [{"ipTagType": "str", "tag": "str"}], + "publicIPAddressVersion": "str", + }, + "subnet": {"id": "str"}, + } + ], + "name": "str", + "dscpConfiguration": {"id": "str"}, + "enableAcceleratedNetworking": bool, + } + ], + "applicationPorts": {"endPort": 0, "startPort": 0}, + "capacities": {"str": "str"}, + "computerNamePrefix": "str", + "dataDiskLetter": "str", + "dataDiskSizeGB": 0, + "dataDiskType": "str", + "dscpConfigurationId": "str", + "enableAcceleratedNetworking": bool, + "enableEncryptionAtHost": bool, + "enableNodePublicIP": bool, + "enableNodePublicIPv6": bool, + "enableOverProvisioning": bool, + "ephemeralPorts": {"endPort": 0, "startPort": 0}, + "evictionPolicy": "str", + "frontendConfigurations": [ + { + "applicationGatewayBackendAddressPoolId": "str", + "ipAddressType": "str", + "loadBalancerBackendAddressPoolId": "str", + "loadBalancerInboundNatPoolId": "str", + } + ], + "hostGroupId": "str", + "isSpotVM": bool, + "isStateless": bool, + "multiplePlacementGroups": bool, + "natConfigurations": [ + {"backendPort": 0, "frontendPortRangeEnd": 0, "frontendPortRangeStart": 0} + ], + "natGatewayId": "str", + "networkSecurityRules": [ + { + "access": "str", + "direction": "str", + "name": "str", + "priority": 0, + "protocol": "str", + "description": "str", + "destinationAddressPrefix": "str", + "destinationAddressPrefixes": ["str"], + "destinationPortRange": "str", + "destinationPortRanges": ["str"], + "sourceAddressPrefix": "str", + "sourceAddressPrefixes": ["str"], + "sourcePortRange": "str", + "sourcePortRanges": ["str"], + } + ], + "placementProperties": {"str": "str"}, + "provisioningState": "str", + "secureBootEnabled": bool, + "securityEncryptionType": "str", + "securityType": "str", + "serviceArtifactReferenceId": "str", + "spotRestoreTimeout": "str", + "subnetId": "str", + "useDefaultPublicLoadBalancer": bool, + "useEphemeralOSDisk": bool, + "useTempDataDisk": bool, + "vmApplications": [ + { + "packageReferenceId": "str", + "configurationReference": "str", + "enableAutomaticUpgrade": bool, + "order": 0, + "treatFailureAsDeploymentFailure": bool, + "vmGalleryTags": "str", + } + ], + "vmExtensions": [ + { + "name": "str", + "properties": { + "publisher": "str", + "type": "str", + "typeHandlerVersion": "str", + "autoUpgradeMinorVersion": bool, + "enableAutomaticUpgrade": bool, + "forceUpdateTag": "str", + "protectedSettings": {}, + "provisionAfterExtensions": ["str"], + "provisioningState": "str", + "settings": {}, + "setupOrder": ["str"], + }, + } + ], + "vmImageOffer": "str", + "vmImagePlan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, + "vmImagePublisher": "str", + "vmImageResourceId": "str", + "vmImageSku": "str", + "vmImageVersion": "str", + "vmManagedIdentity": {"userAssignedIdentities": ["str"]}, + "vmSecrets": [ + { + "sourceVault": {"id": "str"}, + "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], + } + ], + "vmSetupActions": ["str"], + "vmSharedGalleryImageId": "str", + "vmSize": "str", + "zoneBalance": bool, + "zones": ["str"], + }, + "sku": {"capacity": 0, "name": "str", "tier": "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 + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_node_types_begin_update(self, resource_group): + response = await ( + await self.client.node_types.begin_update( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "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_node_types_begin_delete(self, resource_group): + response = await ( + await self.client.node_types.begin_delete( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_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_node_types_list_by_managed_clusters(self, resource_group): response = self.client.node_types.list_by_managed_clusters( resource_group_name=resource_group.name, cluster_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself @@ -33,14 +234,13 @@ async def test_node_types_list_by_managed_clusters(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_begin_restart(self, resource_group): + async def test_node_types_begin_deallocate(self, resource_group): response = await ( - await self.client.node_types.begin_restart( + await self.client.node_types.begin_deallocate( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -49,14 +249,13 @@ async def test_node_types_begin_restart(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_begin_reimage(self, resource_group): + async def test_node_types_begin_delete_node(self, resource_group): response = await ( - await self.client.node_types.begin_reimage( + await self.client.node_types.begin_delete_node( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -65,14 +264,13 @@ async def test_node_types_begin_reimage(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_begin_delete_node(self, resource_group): + async def test_node_types_begin_redeploy(self, resource_group): response = await ( - await self.client.node_types.begin_delete_node( + await self.client.node_types.begin_redeploy( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -81,167 +279,28 @@ async def test_node_types_begin_delete_node(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_get(self, resource_group): - response = await self.client.node_types.get( - resource_group_name=resource_group.name, - cluster_name="str", - node_type_name="str", - api_version="2024-09-01-preview", - ) + async def test_node_types_begin_reimage(self, resource_group): + response = await ( + await self.client.node_types.begin_reimage( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"force": bool, "nodes": ["str"], "updateType": "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_node_types_begin_create_or_update(self, resource_group): + async def test_node_types_begin_restart(self, resource_group): response = await ( - await self.client.node_types.begin_create_or_update( + await self.client.node_types.begin_restart( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - parameters={ - "additionalDataDisks": [ - {"diskLetter": "str", "diskSizeGB": 0, "diskType": "StandardSSD_LRS", "lun": 0} - ], - "additionalNetworkInterfaceConfigurations": [ - { - "ipConfigurations": [ - { - "name": "str", - "applicationGatewayBackendAddressPools": [{"id": "str"}], - "loadBalancerBackendAddressPools": [{"id": "str"}], - "loadBalancerInboundNatPools": [{"id": "str"}], - "privateIPAddressVersion": "IPv4", - "publicIPAddressConfiguration": { - "name": "str", - "ipTags": [{"ipTagType": "str", "tag": "str"}], - "publicIPAddressVersion": "IPv4", - }, - "subnet": {"id": "str"}, - } - ], - "name": "str", - "dscpConfiguration": {"id": "str"}, - "enableAcceleratedNetworking": bool, - } - ], - "applicationPorts": {"endPort": 0, "startPort": 0}, - "capacities": {"str": "str"}, - "computerNamePrefix": "str", - "dataDiskLetter": "str", - "dataDiskSizeGB": 0, - "dataDiskType": "StandardSSD_LRS", - "dscpConfigurationId": "str", - "enableAcceleratedNetworking": bool, - "enableEncryptionAtHost": False, - "enableNodePublicIP": bool, - "enableNodePublicIPv6": bool, - "enableOverProvisioning": bool, - "ephemeralPorts": {"endPort": 0, "startPort": 0}, - "evictionPolicy": "str", - "frontendConfigurations": [ - { - "applicationGatewayBackendAddressPoolId": "str", - "ipAddressType": "IPv4", - "loadBalancerBackendAddressPoolId": "str", - "loadBalancerInboundNatPoolId": "str", - } - ], - "hostGroupId": "str", - "id": "str", - "isPrimary": bool, - "isSpotVM": bool, - "isStateless": False, - "multiplePlacementGroups": False, - "name": "str", - "natConfigurations": [{"backendPort": 0, "frontendPortRangeEnd": 0, "frontendPortRangeStart": 0}], - "natGatewayId": "str", - "networkSecurityRules": [ - { - "access": "str", - "direction": "str", - "name": "str", - "priority": 0, - "protocol": "str", - "description": "str", - "destinationAddressPrefix": "str", - "destinationAddressPrefixes": ["str"], - "destinationPortRange": "str", - "destinationPortRanges": ["str"], - "sourceAddressPrefix": "str", - "sourceAddressPrefixes": ["str"], - "sourcePortRange": "str", - "sourcePortRanges": ["str"], - } - ], - "placementProperties": {"str": "str"}, - "provisioningState": "str", - "secureBootEnabled": bool, - "securityType": "str", - "serviceArtifactReferenceId": "str", - "sku": {"capacity": 0, "name": "str", "tier": "str"}, - "spotRestoreTimeout": "str", - "subnetId": "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", - "useDefaultPublicLoadBalancer": bool, - "useEphemeralOSDisk": bool, - "useTempDataDisk": bool, - "vmApplications": [ - { - "packageReferenceId": "str", - "configurationReference": "str", - "enableAutomaticUpgrade": bool, - "order": 0, - "treatFailureAsDeploymentFailure": bool, - "vmGalleryTags": "str", - } - ], - "vmExtensions": [ - { - "name": "str", - "publisher": "str", - "type": "str", - "typeHandlerVersion": "str", - "autoUpgradeMinorVersion": bool, - "enableAutomaticUpgrade": bool, - "forceUpdateTag": "str", - "protectedSettings": {}, - "provisionAfterExtensions": ["str"], - "provisioningState": "str", - "settings": {}, - "setupOrder": ["str"], - } - ], - "vmImageOffer": "str", - "vmImagePlan": {"name": "str", "product": "str", "promotionCode": "str", "publisher": "str"}, - "vmImagePublisher": "str", - "vmImageResourceId": "str", - "vmImageSku": "str", - "vmImageVersion": "str", - "vmInstanceCount": 0, - "vmManagedIdentity": {"userAssignedIdentities": ["str"]}, - "vmSecrets": [ - { - "sourceVault": {"id": "str"}, - "vaultCertificates": [{"certificateStore": "str", "certificateUrl": "str"}], - } - ], - "vmSetupActions": ["str"], - "vmSharedGalleryImageId": "str", - "vmSize": "str", - "zones": ["str"], - }, - api_version="2024-09-01-preview", + parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, ) ).result() # call '.result()' to poll until service return final result @@ -250,14 +309,13 @@ async def test_node_types_begin_create_or_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_begin_update(self, resource_group): + async def test_node_types_begin_start(self, resource_group): response = await ( - await self.client.node_types.begin_update( + await self.client.node_types.begin_start( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - parameters={"sku": {"capacity": 0, "name": "str", "tier": "str"}, "tags": {"str": "str"}}, - api_version="2024-09-01-preview", + parameters={"force": bool, "nodes": ["str"], "updateType": "str"}, ) ).result() # call '.result()' to poll until service return final result @@ -266,15 +324,55 @@ async def test_node_types_begin_update(self, resource_group): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_node_types_begin_delete(self, resource_group): + async def test_node_types_begin_start_fault_simulation(self, resource_group): response = await ( - await self.client.node_types.begin_delete( + await self.client.node_types.begin_start_fault_simulation( resource_group_name=resource_group.name, cluster_name="str", node_type_name="str", - api_version="2024-09-01-preview", + parameters={"parameters": "fault_simulation_content"}, ) ).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_node_types_begin_stop_fault_simulation(self, resource_group): + response = await ( + await self.client.node_types.begin_stop_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"simulationId": "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_node_types_get_fault_simulation(self, resource_group): + response = await self.client.node_types.get_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + parameters={"simulationId": "str"}, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_node_types_list_fault_simulation(self, resource_group): + response = self.client.node_types.list_fault_simulation( + resource_group_name=resource_group.name, + cluster_name="str", + node_type_name="str", + ) + result = [r async for r in response] + # please add some check logic here by yourself + # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations.py index a400365a3780..9c30a29add82 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_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,12 +20,11 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy - def test_operation_results_get(self, resource_group): - response = self.client.operation_results.get( + def test_operation_results_begin_get(self, resource_group): + response = self.client.operation_results.begin_get( location="str", operation_id="str", - api_version="2024-09-01-preview", - ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations_async.py index 9c0e2e652037..6087e98a1e71 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_results_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,12 +21,13 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async - async def test_operation_results_get(self, resource_group): - response = await self.client.operation_results.get( - location="str", - operation_id="str", - api_version="2024-09-01-preview", - ) + async def test_operation_results_begin_get(self, resource_group): + response = await ( + await self.client.operation_results.begin_get( + location="str", + operation_id="str", + ) + ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations.py index 1f36befb7c34..d3d2d73cd718 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_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_operation_status_get(self, resource_group): response = self.client.operation_status.get( location="str", operation_id="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations_async.py index 4a10ef1fac9e..be8b2a154c71 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operation_status_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_operation_status_get(self, resource_group): response = await self.client.operation_status.get( location="str", operation_id="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations.py index 3b7ea39a4670..92224aaff8e6 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_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="2024-09-01-preview", - ) + response = self.client.operations.list() result = [r for r in response] # please add some check logic here by yourself # ... diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations_async.py index dae7785581b7..0c40750fd2bb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_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="2024-09-01-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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations.py index 78cb81f5fab0..fe9542fb6162 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_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_services_get(self, resource_group): cluster_name="str", application_name="str", service_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -56,7 +55,6 @@ def test_services_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -71,7 +69,6 @@ def test_services_update(self, resource_group): application_name="str", service_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -85,7 +82,6 @@ def test_services_begin_delete(self, resource_group): cluster_name="str", application_name="str", service_name="str", - api_version="2024-09-01-preview", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -98,7 +94,6 @@ def test_services_list_by_applications(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations_async.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations_async.py index 8d1978490586..319d0b931e17 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_operations_async.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/generated_tests/test_service_fabric_managed_clusters_management_services_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_services_get(self, resource_group): cluster_name="str", application_name="str", service_name="str", - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -58,7 +57,6 @@ async def test_services_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -74,7 +72,6 @@ async def test_services_update(self, resource_group): application_name="str", service_name="str", parameters={"tags": {"str": "str"}}, - api_version="2024-09-01-preview", ) # please add some check logic here by yourself @@ -89,7 +86,6 @@ async def test_services_begin_delete(self, resource_group): cluster_name="str", application_name="str", service_name="str", - api_version="2024-09-01-preview", ) ).result() # call '.result()' to poll until service return final result @@ -103,7 +99,6 @@ async def test_services_list_by_applications(self, resource_group): resource_group_name=resource_group.name, cluster_name="str", application_name="str", - api_version="2024-09-01-preview", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py index f4ffd85e03a5..3794e79e5407 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py @@ -53,7 +53,6 @@ "Programming Language :: Python", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", @@ -77,7 +76,7 @@ "isodate>=0.6.1", "typing-extensions>=4.6.0", "azure-common>=1.1", - "azure-mgmt-core>=1.3.2", + "azure-mgmt-core>=1.5.0", ], - python_requires=">=3.8", + python_requires=">=3.9", ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/tsp-location.yaml b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/tsp-location.yaml new file mode 100644 index 000000000000..062afa71325d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/servicefabricmanagedclusters/ServiceFabricManagedClusters.Management +commit: b9a8c9e8eb8998a222f126a005d1ab633f1daad9 +repo: Azure/azure-rest-api-specs +additionalDirectories: